问题:单选题public static void main(String[] args) { try { args=null; args[0] = “test”; System.out.println(args[0]); } catch (Exception ex) { System.out.println(”Exception”); } catch (NullPointerException npe) { System.out.println(”NullPointerException”); ...
查看答案
问题:单选题1.public class Test { 2.public static void main (String args[]) { 3.class Foo { 4.public int i = 3; 5.} 6.Object o = (Object) new Foo(); 7.Foo foo = (Foo)o; 8.System.out.printIn(foo. i); 9. } 10.} What is the result?()A Compilation will fail...
问题:10. interface A { void x(); } 11. class B implements A { pu...
问题:Which method in the Thread class is used to create and launc...
问题:public class returnIt ( returnType methodA(byte x, double...
问题:多选题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 ...
问题:单选题Which of the following range of short is correct?()A -27 -- 27-1B 0 -- 216-1C -215 -- 215-1D -231 -- 231-1...
问题:5. String foo = “base”; 6. foo.substring(0,3); 7. foo.co...
问题:单选题A class games.cards.Poker is correctly defined in the jar file Poker.jar. A user wants to execute the main method of Poker on a UNIX system using the command: java games.cards.Poker What allows the user to do this?()A put Poker.jar in directory /st...
问题:public class SyncTest{ public static void main(String args...
问题:多选题Which two are equivalent?()A3/2B32C3*4D32E3*2^2F32...
问题:public static void test(String str) { int check = 4; if (ch...
问题:public abstract class Shape { int x; int y; public abstra...
问题:单选题10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. } And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine?()A StackOverflowErrorB NullPointerExcepti...
问题:单选题10. interface A { void x(); } 11. class B implements A { public void x() { } public voidy() { } } 12. class C extends B { public void x() {} } And: 20. java.util.List list = new java.util.ArrayList(); 21. list.add(new B()); 22. list.add(new C());...
问题:多选题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;...
问题:单选题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...
问题:Which two valid declarations of a char? ()...
问题:单选题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...
问题:多选题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...