当前分类: OCJP(310-065)
问题:多选题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: 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...
问题:多选题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: 11.String test = "This is a test"; 12.String[] tokens = test.split("/s"); 13.System.out.println(tokens.length); What is the result?()A 0B 1C 4D Compilation fails....
问题:多选题Which two statements are true about the hashCode method?()AThe hashCode method for a given class can be used to test for object equality and object inequality for that class.BThe hashCode method is used by the java.util.SortedSet collection class to or...
问题:多选题Given a class whose instances, when found in a collection of objects, are sorted by using the compare To method, which two statements are true?()AThe class implements java.lang.Comparable.BThe class implements java.util.Comparator.CThe interface used t...
问题:单选题Given: 12.Date date = new Date(); 13.df.setLocale(Locale.ITALY); 14.String s = df.format(date); The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000?()A The va...
问题:多选题Given: 35.String #name = "Jane Doe"; 36.int $age = 24; 37.Double _height = 123.5; 38.double ~temp = 37.5; Which two statements are true?()ALine 35 will not compile.BLine 36 will not compile.CLine 37 will not compile.DLine 38 will not compile....
问题:单选题Given: What is the result?()A No output is produced. 1 2 3B No output is produced. 2 3 4C No output is produced. 1 2 3 4D An exception is thrown at runtime. 1 2 3...
问题:单选题Given a valid DateFormat object named df,and 16.Date d = new Date(0L); 17.String ds = "December 15, 2004"; 18.//insert code here What updates d’s value with the date represented by ds?()A 18. d = df.parse(ds);B 18. d = df.getDate(ds);C 18. try {19. d =...
问题:单选题Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()A any classB only the Target classC any class in the test packageD any class that extends Target...
问题:多选题A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Bookclass?()AThe JAR fi...
问题:多选题Which three statements concerning the use of the java.io.Serializable interface are true?()AObjects from classes that use aggregation cannot be serialized.BAn object serialized on one JVM can be successfully deserialized on a different JVM.CThe values ...
问题:单选题Given that c is a reference to a valid java.io.Console object, and: 11.String pw = c.readPassword("%s", "pw: "); 12.System.out.println("got " + pw); 13.String name = c.readLine("%s", "name: "); 14.System.out.println(" got ", name); If the user types fi...
问题:单选题Given that the elements of a PriorityQueue are ordered according to natural ordering,and: What is the result?()A apple pearB banana pearC apple appleD apple bananaE banana banana...
问题:单选题Which statement is true?()A A class’s finalize() method CANNOT be invoked explicitly.B super.finalize() is called implicitly by any overriding finalize() method.C The finalize() method for a given object is called no more than once by the garbage colle...
问题:单选题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: What is the result?()A Compilation fails.B An exception is thrown at runtime.C The code executes normally and prints "sleep".D The code executes normally, but nothing is printed....