多项选择题Which three will compile and run without exception?()

A.private synchronized Object o;
B.void go() {synchronized() { /* code here */ }
C.public synchronized void go() { /* code here */ }
D.private synchronized(this) void go() { /* code here */ }
E.void go() {synchronized(Object.class) { /* code here */ }
F.void go() {Object o = new Object();synchronized(o) { /* code here */ }


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

Given:

What can be a result?()

A.Compilation fails.
B.An exception is thrown at runtime.
C.The code executes and prints "StartedComplete".
D.The code executes and prints "StartedComplete0123".
E.The code executes and prints "Started0123Complete".

2.单项选择题

Given:

What, inserted at line 39, will sort the keys in the props HashMap?()

A.Arrays.sort(s);
B.s = new TreeSet(s);
C.Collections.sort(s);
D.s = new SortedSet(s);

3.单项选择题

Given:

What is the result?()

A.2 -1
B.2 -4
C.2 -5
D.3 -1
E.3 -4

4.单项选择题

Given:

What is the result?()

A.Compilation fails.
B.An exception is thrown at runtime.
C.[608, 609, 610, 612] [608, 610]
D.[608, 609, 610, 612] [608, 609, 610]
E.[606, 608, 609, 610, 612] [608, 610]
F.[606, 608, 609, 610, 612] [608, 609, 610]

5.单项选择题

Given:

What is the result?()

A.2.1.0
B.2.1.1
C.3.2.1
D.3.2.2

7.多项选择题

Given:

Which three code fragments, inserted independently at line 6, will compile?()

A.list.add("foo");
B.Object o = list;
C.String s = list.get(0);
D.list = new ArrayList();

8.多项选择题

Given:

Which two, inserted at line 11, will allow the code to compile?()

A.public&ensp;class&ensp;MinMax<;?>;&ensp;{
B.public&ensp;class&ensp;MinMax<;?extends&ensp;Number>;&ensp;{
C.public&ensp;class&ensp;MinMax<;Nextends&ensp;Object>;&ensp;{
D.public&ensp;class&ensp;MinMax<;Nextends&ensp;Number>;&ensp;{
E.public&ensp;class&ensp;MinMax<;?extends&ensp;Object>;&ensp;{
F.public&ensp;class&ensp;MinMax<;Nextends&ensp;Integer>;&ensp;{

9.单项选择题

Given:

What is the result?()

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

10.多项选择题

Given:

Which three are true?()

A.Cat is-a Animal
B.Cat is-a Jumper
C.Dog is-a Animal
D.Dog is-a Jumper
E.Cat has-a Animal
F.Beagle has-a Tail

最新试题

Given:What is the result?()

题型:单项选择题

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

题型:单项选择题

Given:What is the appropriate definition of the hashCode method in class Person?()

题型:单项选择题

Given:What is the result?()

题型:单项选择题

Given:A programmer is developing a class Key, that will be used as a key in a standard java.util.HashMap. Which two methods should be overridden to assure that Key works correctly as a key?()

题型:多项选择题

Given:What is the result?()

题型:单项选择题

Given:What is the result?()

题型:单项选择题

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

题型:多项选择题

Given a correctly compiled class whose source code is:Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that theclasspath contains "." (current directory).Which command line correctly runs Commander?()

题型:单项选择题