当前分类: SCJP程序员认证考试
问题:多选题Which two valid declarations of a char?()AChar ch = “a”;BChar ch = ‘/’ ‘;CChar ch = ‘cafe’;DChar ch = “cafe”;EChar ch = ‘/ucafe’;FChar ch = ‘/u10100’;GChar ch = (char) true;...
查看答案
问题:单选题10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile?()A Direction d = NORTH;B Nav.Direction d = N...
问题:单选题public class Test { private static int[] x; public static void main(String[] args) { System.out.println(x[0]); } } What is the result?()A 0B nullC Compilation fails.D A NullPointerException is thrown at runtime.E An ArrayIndexOutOfBoundsExc...
问题:多选题AnInterface is an interface. AnAdapter0 is a non-abstract, non-final class with a zero argument constructor. AnAdapter1 is a non-abstract, non-final class without a zero argument constructor, but with a constructor that takes one int argument. W...
问题:多选题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?()Apublic void aMethod() {}Bprivate void aMethod() {}Cpublic void aMethod(String s) {}Dprivate Y aMethod...
问题:public class SyncTest{ public static void main(String args...
问题:单选题int x=0; int y 10; do { y--; ++x; } while (x 5); System.out.print(x + “,“ + y); What is the result?()A 5,6B 5,5C 6,5D 6,6...
问题:10. interface A { void x(); } 11. class B implements A { pu...
问题:int i = 1,j = 10; do { if(i>j) { break; } j--; } while ...
问题:单选题Which of the following assignment is not correct?()A float f = 11.1;B double d = 5.3E12;C double d = 3.14159;D double d = 3.14;....
问题:多选题Which of the following fragments might cause errors?()AString s = Gone with the wind;String t = good ;String k = s + t;BString s = Gone with the wind;String t;t = s[3] + one;CString s = Gone with the wind;String standard = s.toUpperCase();DString s = ...
问题:单选题1) class Person { 2) public void printValue(int i, int j) {/*…*/ } 3) public void printValue(int i){/*...*/ } 4) } 5) public class Teacher extends Person { 6) public void printValue() {/*...*/ } 7) public void printValue(int i) {/*......
问题:单选题public class Threads5 { public static void main (String[] args) { new Thread(new Runnable() { public void run() { System.out.print(”bar”); } }).start(); } } What is the result?()A Compilation fails.B An exception is thrown at runtime.C The c...
问题:多选题public void test() { try { oneMethod(); System.out.println("condition 1"); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("condition 2"); } catch(Exception e) { System.out.println("condition 3"); } finally { Syst...
问题:多选题Which two CANNOT directly cause a thread to stop executing?()ACalling the yield method.BCalling the wait method on an object.CCalling the notify method on an object.DCalling the notifyAll method on an object.ECalling the start method on another Thread ...
问题:多选题public interface Foo { int k = 4; 3. } Which three are equivalent to line 2?()Afinal int k = 4;Bpublic int k = 4;Cstatic int k = 4;Dabstract int k = 4;Evolatile int k = 4;Fprotected int k = 4;...
问题:5. String foo = “base”; 6. foo.substring(0,3); 7. foo.co...
问题:单选题Which of the following range of short is correct?()A -27 -- 27-1B 0 -- 216-1C -215 -- 215-1D -231 -- 231-1...
问题:11. public static void main(String[] args) { 12. Object obj...
问题:Which two valid declarations of a char? ()...