单项选择题

Given:

When line 14 is reached, how many objects are eligible for the garbage collector?()

A.0
B.1
C.2
D.3
E.4


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

Given:

What is the result?()

A.Compilation fails.
B.An exception is thrown at runtime.
C.doStuff x = 6 main x = 6
D.doStuff x = 5 main x = 5
E.doStuff x = 5 main x = 6

2.单项选择题

Given:

and two separate command line invocations:
java Yippee
java Yippee 1 2 3 4
What is the result?()

A.No output is produced.1 2 3
B.No output is produced.2 3 4
C.No output is produced.1 2 3 4
D.An exception is thrown at runtime.1 2 3

3.单项选择题

Given:

What is the result?()

A.81
B.82
C.91
D.92

4.单项选择题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 collector.
D.The order in which finalize() is called on two objects is based on the order in which the two objects became finalizable.

5.多项选择题

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?()

A.java MainClass if run from the /apps directory
B.java com.company.application.MainClass if run from the /apps directory
C.java -classpath /apps com.company.application.MainClass if run from any directory
D.java -classpath . MainClass if run from the /apps/com/company/application directory
E.java -classpath /apps/com/company/application:. MainClass if run from the /apps directory

6.单项选择题

Given the following directory structure:
bigProject
|--source
||--Utils.java|
|--classes
|--
And the following command line invocation:
javac -d classes source/Utils.java
Assume the current directory is bigProject,what is the result?()

A.If the compile is successful, Utils.class is added to the source directory.
B.The compiler returns an invalid flag error.
C.If the compile is successful, Utils.class is added to the classes directory.
D.If the compile is successful, Utils.class is added to the bigProject directory.

8.单项选择题

Given a class Repetition:

Which code should be inserted at line 1 of Demo.java to compile and run Demo to print "pizzapizza"?()

A.import utils.*;
B.static import utils.*;
C.import utils.Repetition.*;
D.static import utils.Repetition.*;
E.import utils.Repetition.twice();
F.import static utils.Repetition.twice;

9.单项选择题

Given:

What is the result?()

A.Compilation fails due to an error in line 23.
B.Compilation fails due to an error in line 29.
C.A ClassCastException occurs in line 29.
D.A ClassCastException occurs in line 31.
E.The value of all four objects prints in natural order.

10.多项选择题

Given a pre-generics implementation of a method:

What three changes allow the class to be used with generics and avoid an unchecked warning?()

A.Remove line 14.
B.Replace line 14 with "int i = iter.next();".
C.Replace line 13 with "for (int i : intList) {".
D.Replace line 13 with "for (Iterator iter : intList) {".
E.Replace the method declaration with "sum(List intList)".


最新试题

Given:What is the result?()

题型:单项选择题

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?()

题型:单项选择题

Click the Exhibit button.What is the result?()

题型:单项选择题

Click the Exhibit buttonWhich two statements are true if a NullPointerException is thrown on line 3 of class C?()

题型:多项选择题

Given:What is the result?()

题型:单项选择题

Given:What are four valid examples of polymorphic method calls?()

题型:多项选择题

Given a method that must ensure that its parameter is not null:What, inserted at line 12, is the appropriate way to handle a null value?()

题型:单项选择题

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?()

题型:单项选择题

Given:Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?()

题型:单项选择题

Given:What is the result?()

题型:单项选择题