Compilation fails.
Gobstopper Fizzylifting
Gobstopper Scrumdiddlyumptious
Scrumdiddlyumptious Fizzylifltng
Scrumdiddlyumptious Scrumdiddlyumptious
第1题:
为使下列代码正常运行,应该在下画线处填入的选项是( )。 abstract class person{ public Person(String n){ name=n: } Public String getDescription; public String getName{ return name; } private string name; }
A.static
B.private
C.abstract
D.final
第2题:
public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(String name){ System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?()
第3题:
public class CreditCard { private String cardlD; private Integer limit; public String ownerName; public void setCardlnformation(String cardlD, String ownerName, 28. Integer limit) { this.cardlD = cardlD; this.ownerName = ownerName; this.limit = limit; } } Which is true?()
第4题:
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”)后程序的输出是哪项?()
第5题:
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?()
第6题:
public class Pet{ private String name; public Pet(){ System.out.print(1); } public Pet(String name){ System.out.print(2); } } public class Dog extends Pet{ public Dog(){ System.out.print(4); } public Dog(String name){ this(); System.out.print(3); } } 执行new Dog(“棕熊”);后程序输出是哪项?()
第7题:
33
13
23
123
第8题:
23
13
123
321
第9题:
smith
null
编译错误
name
第10题:
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.
第11题:
smith,SALES
null,SALES
smith,null
null,null
第12题:
insert a call to this() in the Car constructor
insert a call to this() in the MeGo constructor
insert a call to super() in the MeGo constructor
insert a call to super(vin) in the MeGo constructor
change the wheelCount variable in Car to protected
change line 3 in the MeGo class to super.wheelCount = 3;
第13题:
第14题:
Which two allow the class Thing to be instantiated using new Thing()?
第15题:
public class Employee{ private String name; public Employee(String name){ this.name = name; } public String getName(){ return name; } } public class Manager extends Employee{ public Manager(String name){ System.out.println(getName()); } } 执行语句new Manager(“smith”)后程序的输出是哪项?()
第16题:
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?()
第17题:
Given the following code: 1) class Parent { 2) private String name; 3) public Parent(){} 4) } 5) public class Child extends Parent { 6) private String department; 7) public Child() {} 8) public String getValue(){ return name; } 9) public static void main(String arg[]) { 10) Parent p = new Parent(); 11) } 12) } Which line will cause error?()
第18题:
smith,SALES
null,SALES
smith,null
null,null
编译错误
第19题:
smith
null
SALES
编译错误
第20题:
The class is fully encapsulated.
The code demonstrates polymorphism.
The ownerName variable breaks encapsulation.
The cardlD and limit variables break polymorphism.
The setCardlnformation method breaks encapsulation.
第21题:
declare reset() using the synchronized keyword
declare getName() using the synchronized keyword
declare getCount() using the synchronized keyword
declare the constructor using the synchronized keyword
declare increment() using the synchronized keyword
第22题:
line 3
line 6
line 7
line 8
line 10
第23题:
smith
null
SALES
编译错误