当前分类: SCJP程序员认证考试
问题:填空题3. string foo = “ABCDE”; 4. foo.substring(3); 5. foo.concat(“XYZ”); 6. Type the value of foo at line 6.()...
查看答案
问题:多选题11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12?()AfinalBstaticCnativeDpublicEprivateFabstractGprotected...
问题:单选题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...
问题:单选题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 Transfers { public static void main(String[] args) throws Exception { Record r1 = new Record(); Record r2 = new Record(); doTransfer(r1, r2, 5); doTransfer(r2, r1, 2); doTransfer(r1, r2, 1); // print the result System.out.println(”...
问题:单选题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...
问题:import java.io.IOException; public class ExceptionTest( ...
问题:单选题20. public float getSalary(Employee e) { 21. assert validEmployee(e); 22. float sal = lookupSalary(e); 23. assert (sal0); 24. return sal; 25. } 26. private int getAge(Employee e) { 27. assert validEmployee(e); 28. int age = lookupAge(e); 29. a...
问题:int i = 0; while (true) { if(i==4) { break; } ++i; } S...
问题:public class Test { public static void main(String args[]) ...
问题:单选题public class Foo { public void main (String args) { system.out.printIn(“Hello World.”); } } What is the result? ()A An exception is thrown.B The code does no compile.C “Hello World.” Is printed to the terminal.D The program exits without ...
问题:多选题Which four types of objects can be thrown using the throw statement?()AErrorBEventCObjectDExceptionEThrowableFRuntimeException...
问题:单选题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...
问题:public class X { public static void main(String [] args) { ...
问题:public class X implements Runnable( private int x; priv...
问题:Given the fully-qualified class names: com.foo.bar.Dog com...
问题:Which statement is true?()...
问题:多选题10. class MakeFile { 11. public static void main(String[] args) { 12. try { 13. File directory = new File(”d”); 14. File file = new File(directory,”f”); 15. if(!file.exists()) { 16. file.createNewFile(); 17. } 18. } catch (IOException e) { 19....
问题:多选题Assume that country is set for each class. Given: 10. public class Money { 11. private String country, name; 12. public getCountry() { return country; } 13.} and: 24. class Yen extends Money { 25. public String getCountry() { return super.count...
问题:Which of these are keywords in Java?() ...