当前分类: OCJP(310-065)
问题:单选题Given: Which code, inserted at line 16, will cause a java.lang.ClassCastException?()A Alpha a = x;B Foo f = (Delta)x;C Foo f = (Alpha)x;D Beta b = (Beta)(Alpha)x;...
查看答案
问题:单选题Which Man clsss properly represents the relationship "Man has a best friend who is a Dog"?()A class Man extends Dog { }B class Man implements Dog { }C class Man { private BestFriend dog; }D class Man { private Dog bestFriend; }E class Man { private Dog...
问题:单选题Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length 0) ? elements[0] : null; What is the result?()A Compilation fails.B An exception is thrown at runtime.C The variable first is set to null.D The variable first is set t...
问题:多选题Which four statements are true?()AHas-a relationships should never be encapsulated.BHas-a relationships should be implemented using inheritance.CHas-a relationships can be implemented using instance variables.DIs-a relationships can be implemented usin...
问题:单选题Which can appropriately be thrown by a programmer using Java SE technology to create a desktop application?()A ClassCastExceptionB NullPointerExceptionC NoClassDefFoundErrorD NumberFormatExceptionE ArrayIndexOutOfBoundsException...
问题:单选题Given: What is the result?()A Compilation succeeds.B Compilation fails due to multiple errors.C Compilation fails due to an error only on line 20.D Compilation fails due to an error only on line 21.E Compilation fails due to an error only on line...
问题:多选题Which two statements are true?()AIt is possible for more than two threads to deadlock at once.BThe JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.CDeadlocked threads release once their sleep() method’s sleep du...
问题:多选题Click the Exhibit button. What two must the programmer do to correct the compilation errors?()Ainsert a call to this() in the Car constructorBinsert a call to this() in the MeGo constructorCinsert a call to super() in the MeGo constructorDinsert a cal...
问题:单选题A programmer has an algorithm that requires a java.util.List that provides an efficient implementation of add(0, object), but does NOT need to support quick random access. What supports these requirements?()A java.util.QueueB java.util.ArrayListC java....
问题:单选题A UNIX user named Bob wants to replace his chess program with a new one, but he is not sure where theold one is installed. Bob is currently able to run a Java chess program starting from his home directory /home/bob using thecommand: java -classpath /...
问题:多选题Given: Which four code fragments, inserted independently at line 7, will compile?()Apublic void m1() { }Bprotected void m1() { }Cprivate void m1() { }Dvoid m2() { }Epublic void m2() { }Fprotected void m2() { }...
问题:多选题Given: And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to "." (current directory). Which two java commands entered at the commandline will run MainClass?()Ajava MainClass if run fro...
问题:多选题Given: Which three are true?()ACat is-a AnimalBCat is-a JumperCDog is-a AnimalDDog is-a JumperECat has-a AnimalFBeagle has-a Tail...
问题:多选题Which three will compile and run without exception?()Aprivate synchronized Object o;Bvoid go() {synchronized() { /* code here */ }Cpublic synchronized void go() { /* code here */ }Dprivate synchronized(this) void go() { /* code here */ }Evoid go() {syn...
问题:多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInput...
问题:单选题Given: 11.String test = "a1b2c3"; 12.String[] tokens = test.split("//d"); 13.for(String s: tokens) System.out.print(s + " "); What is the result?()A a b cB 1 2 3C a1b2c3D a1 b2 c3...
问题:单选题Given: What is the result?()A 5,6B 5,5C 6,5D 6,6...
问题:单选题Given: What is the result?()A r, t, t,B r, e, o,C Compilation fails.D An exception is thrown at runtime....
问题:单选题Given: What is the result?()A test endB Compilation fails.C test runtime endD test exception endE A Throwable is thrown by main at runtime....