当前分类: SCJP程序员认证考试
问题:单选题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 interface A { String DEFAULT_GREETING = “Hello World...
问题:单选题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...
问题:多选题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 ...
问题:单选题public class ExceptionTest { class TestException extends Exception {} public void runTest () throws TestException {} public void test () /* Point X*/ { runTest (); } } At point X on line 4, which code can be added to make the code compile?()A ...
问题:Which two cause a compiler error?() ...
问题:填空题3. string foo = “ABCDE”; 4. foo.substring(3); 5. foo.concat(“XYZ”); 6. Type the value of foo at line 6.()...
问题:单选题public class X { public static void main (Stringargs) { String s1 = new String (“true”); Boolean b1 = new Boolean (true); if (s2.equals(b1)) { System.out.printIn(“Equal”); } } } What is the result? ()A The program runs and prints not...
问题:What will be written to the standard output when the followi...
问题:Which of these are keywords in Java?() ...
问题:多选题You need to store elements in a collection that guarantees that no duplicates are stored. Which two interfaces provide that capability?()AJava.util.MapBJava.util.SetCJava.util.ListDJava.util.StoredSetEJava.util.StoredMapFJava.util.Collection...
问题:多选题11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12?()AfinalBstaticCnativeDpublicEprivateFabstractGprotected...
问题:public class X { public object m () { object o = new flo...
问题:单选题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...
问题:int i = 0; while (true) { if(i==4) { break; } ++i; } S...
问题:What is wrong with the following code?() class MyException...
问题:public class X { public static void main(String [] args) { ...
问题:10. class MakeFile { 11. public static void main(String[] a...
问题:public class X implements Runnable( private int x; priv...
问题:单选题public class Test { public static void main(String args[]) { class Foo { public int i = 3; } Object o = (Object)new Foo(); Foo foo = (Foo)o; System.out.println(“i = “ + foo.i); } } What is the result?()A i = 3B Compilation fails.C A ClassCa...