举一反三
- Student类是Person类的子类,分析下面语句,转型是否正确: Student s =(Student)new Person("张三", 23);
- 【单选题】父类Person有子类Chinese和American,且两个子类都重写了父类中的walk()方法;下列哪项实现了多态编程 A. Chinese c=new Chinese("张三"); American a=new American("John"); B. Chinese c=new Chinese( "张三"); American a=new American("John"); c.walk(); a.walk(); C. Person person1=new Chinese("张三" ); Person person2=new American("John"); D. Person person1=new Chinese("张三" ); Person person2=new American("John"); person1.walk(); person2.walk();
- 【多选题】定义了如下Person类,下面()程序段能够正确初始化Person数组。 class Person{ private String name; public Person(String name){ this.name=name; } } A. Person [ ] list=new Person[ ]{new Person("孙悟空"),new Person("猪八戒")}; B. Person list[ ]=new Person[ ]{new Person("孙悟空"),new Person("猪八戒")}; C. Person[ ] list={new Person("孙悟空"),new Person("猪八戒")}; D. Person list=new Person[ ]{new Person("孙悟空"),new Person("猪八戒")};
- 使用SQL语句删除表mytest,下列SQL语句正确的是( )。 A: DROP TABLE mytest IF EXISTS B: DROP TABLE IF EXISTS mytest C: ALTER TABLE IF EXISTS mytest ALTER TABLE mytest IF EXISTS
- 【单选题】10、使用SQL语句创建数据库,数据库名为mytest,下列SQL语句写法是正确的是()。 A. create mytest B. create table mytest C. database mytest D. create database mytest
内容
- 0
class Person { String name; int age; [br][/br] public Person(String name, int age) { super(); this.name = name; this.age = age; } @Override public boolean equals(Object obj) { Person person=null; if(obj instanceof Person) person=(Person)obj; if(name.equals(person.name)&&age==person.age) return true; return false; } } class Test{ public static void main(String[] args) { Person person1 = new Person("张三", 12); Person person2 = new Person("张三", 12); System.out.println(person1.equals(person2));//运行结果是? } } 程序运行结果是什么? A: true B: false
- 1
创建数据库使用以下【】语句。 A: CREATE TABLE mytest B: CREATE DATABASE mytest C: CREATE mytest D: DATABASE mytesst
- 2
25.Which of the following is not a good way to welcome a new person? A: a). talk to the new person B: b). give the new person a tour C: c). invite the new person to lunch D: d). ignore the new person's question
- 3
下列JavaScript定义对象的语句中,()不正确。 A: var person = {}; B: var person = new Object(); C: person =name; D: function person(name,sex){} var personObj = new person();
- 4
在Java中,有如下两个类Student和Person。如果Student是Person的子类,则下列声明对象x的语句中错误的是()。 A: Person x = new Student() B: Person x = new Person() C: Student x = new Person() D: Student x = new Student()