问题:单选题Given: 11. String test = "This is a test"; 12. String[] tokens = test.split("/s"); 13. System.out.println(tokens.length); What is the result?()AAn exception is thrown at runtime.B1C4DCompilation fails.E0
查看答案
问题:单选题Given: 11. public static void main(String[] args) { 12. Object obj = new int[] { 1, 2, 3 }; 13. int[] someArray = (int[])obj; 14. for (int i : someArray) System.out.print(i + " "); 15. } What is the result? ()ACompilation fails because of an error in line 13.BA ClassCastException is thrown at runtime.C1 2 3DCompilation fails because of an error in line 14.ECompilation fails because of an error in line 12.
问题:单选题Click the Exhibit button. Given this code from Class B: 25. A a1 = new A(); 26. A a2 = new A(); 27. A a3 = new A(); 28. System.out.println(A.getInstanceCount()); What is the result?()ACompilation of class A fails.BLine 28 prints the value 3 to System.out.CLine 28 prints the value 1 to System.out.DCompilation fails because of an error on line 28.EA runtime error occurs when line 25 executes.
问题:单选题Click the Exhibit button. Given: ClassA a = new ClassA(); a.methodA(); What is the result?()AThe code runs with no output.BCompilation fails.CAn exception is thrown at runtime.DClassC is displayed.
问题:多选题A JavaBeans component has the following field: 11. private boolean enabled; Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()AABBCCDD
问题:多选题Given: 10. interface Jumper { public void jump(); } ... 20. class Animal {} ... 30. class Dog extends Animal { 31. Tail tail; 32. } ... 40. class Beagle extends Dog implements Jumper{ 41. public void jump() {} 42. } ... 50. class Cat implements Jumper{ 51. public void jump() {} 52. }. Which three are true?()ACat is-a JumperBCat is-a AnimalCDog is-a JumperDDog is-a AnimalEBeagle has-a JumperFCat has-a AnimalGBeagle has-a Tail
问题:单选题Given: What is the result?()AABBCCDDEE
问题:单选题Given the command line java Pass2 and: What is the result? ()AdoStuff x = 6 main x = 6BCompilation fails.CdoStuff x = 6 main x = 7DAn exception is thrown at runtime.EdoStuff x = 7 main x = 6FdoStuff x = 7 main x = 7
问题:多选题Which two code fragments correctly create and initialize a static array of int elements?()AABBCCDD
问题:单选题Given: What is the result?()AIf you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.BIf you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.CCompilation fails because of an error in line 9.DIf you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.ECompilation fails because of an error in line 3.FCompilation fails because of an error in line 7.
问题:单选题Given: 12. System.out.format("Pi is approximately %d.", Math.PI); What is the result?()AAn exception is thrown at runtime.BPi is approximately 3.CPi is approximately 3.141593.DCompilation fails.
问题:单选题Given: What is the result?()AAn exception is thrown at runtime.Bint LongCCompilation fails.DShort Long
问题:多选题Given: 11. // insert code here 12. private N min, max; 13. public N getMin() { return min; } 14. public N getMax() { return max; } 15. public void add(N added) { 16. if (min == null || added.doubleValue() max.doubleValue()) 19. max = added; 20. } 21. } Which two, inserted at line 11, will allow the code to compile?()AABBCCDDEEFF
问题:多选题Given: 10. class One { 11. void foo() { } 12. } 13. class Two extends One { 14. //insert method here 15. } Which three methods, inserted individually at line 14, will correctly complete class Two?()Apublic void foo() { /* more code here */ }Bprivate void foo() { /* more code here */ }Cprotected void foo() { /* more code here */ }Dint foo() { /* more code here */ }Evoid foo() { /* more code here */ }