当前分类: SCJP程序员认证考试
问题:public class X { public static void main(String [] args) { ...
查看答案
问题:1. public class X { 2. public static void main (String[]arg...
问题:int i = 0; while (true) { if(i==4) { break; } ++i; } S...
问题:单选题Which statements, when inserted at the indicated position in the following code, will cause a runtime exception when attempting to run the program?() class A {} class B extends A {} class C extends A {} public class Q3ae4 { public static void...
问题:1. interface A { public void aMethod(); } 2. interface B { ...
问题:多选题Which of these are keywords in Java?()AdefaultBNULLCStringDthrowsElong...
问题:多选题11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12?()AfinalBstaticCnativeDpublicEprivateFabstractGprotected...
问题:What produces a compiler error?() ...
问题:单选题A UNIX user named Bob wants to replace his chess program with a new one, but he is hot sure where the old one is installed. Bob is currently able to run a Java chess program starting from his home directory /home/bob using the command: java -classpath...
问题:单选题1. public class Test { 2. int x= 12; 3. public void method(int x) { 4. x+=x; 5. System.out.println(x); 6. } 7. } Given: 34. Test t = new Test(); 35. t.method(5); What is the output from line 5 of the Test class?()A 5B 10C 12D 17E 24...
问题:多选题A team of programmers is reviewing a proposed API for a new utility class.After some discussion, they realize that they can reduce the number of methods in the API without losing any functionality.If they implement the new design, which two principles ...
问题:单选题public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i 10 | methodB (4); b = i 10 || methodB (8); ) public static void main (...
问题:单选题public class X { public object m () { object o = new float (3.14F); object oa = new object [1]; oa[0]= o; o = null; oa[0] = null; return o; } } When is the float object created in line 3, eligible for garbage collection?()A Just af...
问题:填空题3. string foo = “ABCDE”; 4. foo.substring(3); 5. foo.concat(“XYZ”); 6. Type the value of foo at line 6.()...
问题:public class X implements Runnable( private int x; priv...
问题:单选题int i= 1, j= 10 ; do ( if (i++ --j) continue; ) while (i5); After execution, what are the values for I and j?()A i = 6 and j= 5B i = 5 and j= 5C i = 6 and j= 4D i = 5 and j= 6E i = 6 and j= 6...
问题:单选题public class X { public static void main (String[] args) { byte b = 127; byte c = 126; byte d = b + c; } } Which statement is true?()A Compilation succeeds and d takes the value 253.B Line 5 contains an error that prevents compilation.C...
问题:单选题Which gets the name of the parent directory file “file.txt”?()A String name= File.getParentName(“file.txt”);B String name= (new File(“file.txt”)).getParent();C String name = (new File(“file.txt”)).getParentName();D String name= (new File(“file.txt”...
问题:public class Ball { public enum Color { RED, GREEN, BLUE };...
问题:单选题1. public class ForBar { 2. public static void main(String []args) { 3. int i = 0, j = 5; 4. tp: for (;;) { 5. i ++; 6. for(;;) 7. if(i --j) break tp; 8. } 9. system.out.printIn(“i = ” + i + “, j = “+ j); 10. } 11. } What is the resu...