The value of b is 2.00.
The value of a is 3.141.
The value of a is 3.14.
The value of b is 2.0000.
The value of a is 3.1415.
The value of a is 3.1416.
The value of b is 2.
第1题:
11. public class Commander { 12. public static void main(String[] args) { 13. String myProp = /* insert code here */ 14. System.out.println(myProp); 15. } 16. } and the command line: java -Dprop.custom=gobstopper Commander Which two, placed on line 13, will produce the output gobstopper?()
第2题:
11. public void testIfA() { 12. if(testIfB(”True”)) { 13. System.out.println(”True”); 14. } else { 15. System.out.println(”Not true”); 16. } 17. } 18. public Boolean testIfB(String str) { 19. return Boolean.valueOf(str); 20. } What is the result when method testIfA is invoked?()
第3题:
11. class Animal { public String noise() { return “peep”; } } 12. class Dog extends Animal { 13. public String noise() { return “bark”; } 14. } 15. class Cat extends Animal { 16. public String noise() { return “meow”; } 17. } ..... 30. Animal animal = new Dog(); 31. Cat cat = (Cat)animal; 32. System.out.printIn(cat.noise()); What is the result?()
第4题:
1. class A { 3. public String to String() { 4. return “4”; 5. } 6. } 7. class B extends A { 8. public String toString() { 9. return super.toString() + “3”; 10. } 11. } 12. public class Test { 13. public static void main (String[] args) { 14. System.out.printIn(new B()); 15. } 16. } What is the result( )?
第5题:
10. public class MyClass { 11. 12. public Integer startingI; 13. public void methodA() { 14. Integer i = new Integer(25); 15. startingI = i; 16. methodB(i); 17. } 18. private void methodB(Integer i2) { 19. i2 = i2.intValue(); 20. 21. } 22. } If methodA is invoked, which two are true at line 20?()
第6题:
Given: 11.double input = 314159.26; 12.NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); 13.String b; 14.//insert code here Which code, inserted at line 14, sets the value of b to 314.159,26?()
第7题:
A
B
C
D
E
F
第8题:
True
Not true
An exception is thrown at runtime.
Compilation fails because of an error at line 12.
Compilation fails because of an error at line 19.
第9题:
b = nf.parse( input);
b = nf.format( input);
b = nf.equals( input);
b = nf.parseObject( input);
第10题:
peep
bark
meow
Compilation fails.
An exception is thrown at runtime.
第11题:
System.load(”prop.custom”);
System.getenv(”prop.custom”);
System.property(”prop.custom”);
System.getProperty(”prop.custom”);
System.getProperties().getProperty(”prop.custom”);
第12题:
i2 == startingI returns true.
i2 == startingI returns false.
i2.equals(startingI) returns true.
i2.equals(startingI) returns false.
第13题:
1. class TestA { 2. TestB b; 3. TestA() { 4. b = new TestB(this); 5. } 6. } 7. class TestB { 8. TestA a; 9. TestB(TestA a) { 10. this.a = a; 11. } 12. } 13. class TestAll { 14. public static void main (String args[]) { 15. new TestAll().makeThings(); 16. // ...code continues on 17. } 18. void makeThings() { 19. TestA test = new TestA(); 20. } 21. } Which two statements are true after line 15, before main completes?()
第14题:
11. class Converter { 12. public static void main(String[] args) { 13. Integer i = args[0]; 14. int j = 12; 15. System.out.println(”It is “ + (j==i) + “that j==i.”); 16. } 17. } What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?()
第15题:
NumberFormat nf= NumberFormat.getInstance(); nf.setMaximumFractionDigits(4); nf.setMinimumFractionDigits(2); String a = nf.format(3.1415926); String b = nf.format(2); Which two are true about the result if the default locale is Locale.US?()
第16题:
11. double input = 314159.26; 12. NumberFormat nf= NumberFormat.getInstance(Locale.ITALIAN); 13. String b; 14. //insert code here Which code, inserted at line 14, sets the value of b to 3 14.159,26?()
第17题:
11. public static void test(String str) { 12. if(str == null | str.lellgth() == 0) { 13. System.out.println(”String is empty”); 14. } else { 15. System.out.println(”String is not empty”); 16. } 17. } And the invocation: 31. test(llull); What is the result?()
第18题:
Given: 12. NumberFormat nf = NumberFormat.getInstance(); 13. nf.setMaximumFractionDigits(4); 14. nf.setMinimumFractionDigits(2); 15. String a = nf.format(3.1415926); 16. String b = nf.format(2); Which two statements are true about the result if the default locale is Locale.US?()
第19题:
b = nf.parse( input );
b = nf.format( input );
b = nf.equals( input );
b = nf.parseObject( input );
第20题:
Line 15 causes a stack overflow.
An exception is thrown at runtime.
The object referenced by a is eligible for garbage collection.
The object referenced by b is eligible for garbage collection.
The object referenced by a is not eligible for garbage collection.
The object referenced by b is not eligible for garbage collection.
第21题:
Compilation fails because of an error in line 13.
A ClassCastException is thrown at runtime.
1 2 3
Compilation fails because of an error in line 14.
Compilation fails because of an error in line 12.
第22题:
b = nf.parse( input );
b = nf.format( input );
b = nf.equals( input );
b = nf.parseObject( input );
第23题:
The value of b is 2.
The value of a is 3.14.
The value of b is 2.00.
The value of a is 3.141.
The value of a is 3.1415.
The value of a is 3.1416.
The value of b is 2.0000.