A new Item object is created with the preferred value in the id attribute.
The attribute id in the Item object is modified to the new value.
Compilation fails.
An exception is thrown at runtime.
The attribute id in the Item object remains unchanged.
第1题:
Runnable r = new Runnable() { public void run() { System.out.print(”Cat”); } }; Threadt=new Thread(r) { public void run() { System.out.print(”Dog”); } }; t.start(); What is the result?()
第2题:
12. Date date = new Date(); 13. df.setLocale(Locale.ITALY); 14. String s = df.format(date); The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000?()
第3题:
try { if ((new Object))(.equals((new Object()))) { System.out.println(“equal”); }else{ System.out.println(“not equal”); } }catch (Exception e) { System.out.println(“exception”); } What is the result? ()
第4题:
class Base { Base() { System.out.print(“Base”); } } public class Alpha extends Base { public static void main( String[] args ) { new Alpha(); new Base(); } } What is the result?()
第5题:
collie
harrier
Compilation fails.
collie harrier
An exception is thrown at runtime.
第6题:
Cat
Dog
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第7题:
Tea
Coffee
Coffee Tea
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第8题:
42
An exception is thrown at runtime.
Compilation fails because of an error on line 12.
Compilation fails because of an error on line 16.
Compilation fails because of an error on line 17.
第9题:
An exception is thrown at runtime.
int Long
Compilation fails.
Short Long
第10题:
Compilation fails.
An exception is thrown at runtime.
The attribute id in the Item object remains unchanged.
The attribute id in the Item object is modified to the new value.
A new Item object is created with the preferred value in the id attribute.
第11题:
equal
not equal
exception
Compilation fails.
第12题:
1
2
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第13题:
Given that Thing is a class, how many objects and reference variables are created by the following code?() Thing item, stuff; item = new Thing(); Thing entity = new Thing();
第14题:
public class Drink implements Comparable { public String name; public int compareTo(Object o) { return 0; } } and: Drink one = new Drink(); Drink two = new Drink(); one.name= “Coffee”; two.name= “Tea”; TreeSet set = new TreeSet(); set.add(one); set.add(two); A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?()
第15题:
public class ClassA { public int getValue() { int value=0; boolean setting = true; String title=”Hello”; (value || (setting && title == “Hello”)) { return 1; } (value == 1 & title.equals(”Hello”)) { return 2; } } } And: ClassA a = new ClassA(); a.getValue(); What is the result?()
第16题:
Given: 12.Date date = new Date(); 13.df.setLocale(Locale.ITALY); 14.String s = df.format(date); The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000?()
第17题:
r, t, t,
r, e, o,
Compilation fails.
An exception is thrown at runtime.
第18题:
TestA
TestB
Compilation fails.
An exception is thrown at runtime.
第19题:
Base
BaseBase
Compilation fails.
The code runs with no output.
An exception is thrown at runtime.
第20题:
A new Item object is created with the preferred value in the id attribute.
The attribute id in the Item object is modified to the new value.
Compilation fails.
An exception is thrown at runtime.
The attribute id in the Item object remains unchanged.
第21题:
The code runs with no output.
Compilation fails.
An exception is thrown at runtime.
ClassC is displayed.
第22题:
One object is created
Two objects are created
Three objects are created
One reference variable is created
Two reference variables are created
Three reference variables are created.
第23题:
Compilation fails.
exception is thrown at runtime.
The attribute id in the ItemTest object remains unchanged.
The attribute id in the ItemTest object is modified to the new value.
A new ItemTest object is created with the preferred value in the id attribute.
第24题:
Hello
Hello World
Compilation fails.
Hello World 5
The code runs with no output.
An exception is thrown at runtime.