问题:单选题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? ()A Compilation fails because of...
查看答案
问题:多选题Which two code fragments correctly create and initialize a static array of int elements?()AABBCCDD...
问题:单选题Given: 11. public void genNumbers() { 12. ArrayList numbers = new ArrayList(); 13. for (int i=0; i10; i++) { 14. int value = i * ((int) Math.random()); 15. Integer intObj = new Integer(value); 16. numbers.add(intObj); 17. } 18. System.out...
问题:多选题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 the command line java Pass2 and: What is the result? ()A doStuff x = 6 main x = 6B Compilation fails.C doStuff x = 6 main x = 7D An exception is thrown at runtime.E doStuff x = 7 main x = 6F doStuff x = 7 main x = 7...
问题:单选题Given: 12. System.out.format("Pi is approximately %d.", Math.PI); What is the result?()A An exception is thrown at runtime.B Pi is approximately 3.C Pi is approximately 3.141593.D Compilation fails....
问题:多选题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 *...
问题:多选题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 resul...
问题:单选题Given: Which statement is true?()A The cardID and limit variables break polymorphism.B The code demonstrates polymorphism.C The ownerName variable breaks encapsulation.D The setCardInformation method breaks encapsulation.E The class is fully ...
问题:单选题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?()A Compilation of class A fails.B Line 28 prints the v...
问题:多选题Click the Exhibit button. Given: Which two statements are true if a NullPointerException is thrown on line 3 of class C?()AThe application will crash.BThe code on line 29 will be executed.CThe code on line 5 of class A will execute.DThe exception wil...
问题:单选题Given: 11. static class A { 12. void process() throws Exception { throw new Exception(); } 13. } 14. static class B extends A { 15. void process() { System.out.println("B "); } 16. } 17. public static void main(String[] args) { 18. A a ...
问题:单选题Given: What is the result?()A An exception is thrown at runtime.B r, e, o,C Compilation fails.D r, t, t,...
问题:单选题Given: What is the result?()A An exception is thrown at runtime.B int LongC Compilation fails.D Short Long...