Write Hello
Rubber Write Hello
编译错误
运行时抛出异常
第1题:
Which two allow the class Thing to be instantiated using new Thing()?
第2题:
public class Employee{ private String name; public Employee(String name){ this.name = name; } public void display(){ System.out.print(name); } } public class Manager extends Employee{ private String department; public Manager(String name,String department){ super(name); this.department = department; } public void display(){ System.out.println( super.display()+”,”+department); } } 执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?()
第3题:
现有: class Pencil { public void write (String content){ System.out.println( "Write",+content){ } }class RubberPencil extends Pencil{ public void write (String content){ System.out.println("Rubber Write"+content); } public void erase (String content)}} 执行下列代码的结果是哪项?() Pencil pen=new Pencil(); (( RubberPencil) pen).write( "Hello");
第4题:
现有: class Pencil { public void write (String content){ System.out.println ("Write"+content); } } class RubberPencil extends Pencil{ public void erase (String content){ System.out.println ("Erase"+content); } } 执行下列代码的结果是哪项?() Pencil pen=new RubberPencil(); pen.write ("Hello"); pen.erase ("Hello");
第5题:
现有 public class Parentt public void change (int x){) ) public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?()
第6题:
Write Hello Erase Hello
Erase Hello Write Hello
编译错误
运行时抛出异常
第7题:
Write Hello
Rubber Write Hello
编译失败
运行时抛出异常
第8题:
第9题:
protected void change (int x){}
public void change(int x, int y){}
public void change (int x){}
public void change (String s){}
第10题:
Write Hello
Rubber Write Hello
编译错误
运行时抛出异常
第11题:
TeStA
TeStB
编译失败
运行时抛出异常
第12题:
Cause error during compilation.
south east
south to north east to west
south to north east
south east to west
第13题:
现有: class TestApp{ public static void main (String[] args){ for (int i=0; i
第14题:
public class X { public X aMethod() { return this;} } public class Y extends X { } Which two methods can be added to the definition of class Y?()
第15题:
public class Plant { private String name; public Plant(String name) { this.name = name; } public String getName() { return name; } } public class Tree extends Plant { public void growFruit() { } public void dropLeaves() { } } Which is true?()
第16题:
现有: class TestA { public void start() { System.out.println("TestA"); } } public class TestB extends TestA { public void start() { System.out.println("TestB"); } public static void main (string[] args) ( ((TestA)new TestB()).start(); ) } 运行结果是哪项?()
第17题:
public void main(String args[])
public void static main(String args[])
public static main(String[] argv)
final public static void main(String [] array)
public static void main(String args[])
第18题:
Implementation a.
Implementation b.
Implementation c.
Implementation d.
Implementation e.
第19题:
public class Thing { }
public class Thing { public Thing() {} }
public class Thing { public Thing(void) {} }
public class Thing { public Thing(String s) {} }
public class Thing { public void Thing() {} public Thing(String s) {} }
第20题:
public void aMethod() {}
private void aMethod() {}
public void aMethod(String s) {}
private Y aMethod() { return null; }
public X aMethod() { return new Y(); }
第21题:
The code will compile without changes.
The code will compile if public Tree() { Plant(); } is added to the Tree class.
The code will compile if public Plant() { Tree(); } is added to the Plant class.
The code will compile if public Plant() { this(”fern”); } is added to the Plant class.
The code will compile if public Plant() { Plant(”fern”); } is added to the Plant class.
第22题:
第23题:
smith,SALES
null,SALES
smith,null
null,null
第24题:
0123
012456789
0123456789
012