多项选择题

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


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

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.

3.单项选择题

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;

4.单项选择题

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.

5.多项选择题

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)".


6.单项选择题

Given:

Which method will complete this class?()

A.public int compareTo(Object o){/*more code here*/}
B.public int compareTo(Score other){/*more code here*/}
C.public int compare(Score s1,Score s2){/*more code here*/}
D.public int compare(Object o1,Object o2){/*more code here*/}

7.多项选择题Which two statements are true about the hashCode method?()

A.The hashCode method for a given class can be used to test for object equality and object inequality for that class.
B.The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set.
C.The hashCode method for a given class can be used to test for object inequality, but NOT objecte quality, for that class.
D.The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.
E.The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

8.单项选择题

Given:

Which statement is true?()

A.The equals method does NOT properly override the Object.equals method.
B.Compilation fails because the private attribute p.name cannot be accessed in line 5.
C.To work correctly with hash-based data structures,this class must also implement the hashCode method.
D.When adding Person objects to a java.util.Set collection,the equals method in line 4 will prevent duplicates.


9.单项选择题

Given:

What is the result?()

A.The value "4" is printed at the command line.
B.Compilation fails because of an error in line 5.
C.Compilation fails because of an error in line 9.
D.A NullPointerException occurs at runtime.
E.A NumberFormatException occurs at runtime.
F.An IllegalStateException occurs at runtime.

10.单项选择题

Given:

What is the result?()

A.Compilation fails.
B.pi is bigger than 3.
C.An exception occurs at runtime.
D.pi is bigger than 3. Have a nice day.
E.pi is not bigger than 3. Have a nice day.

最新试题

Given:What is the result?()

题型:单项选择题

Click the Exhibit button.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?()

题型:单项选择题

Click the Exhibit button.Which graph represents the correct directory structure for a JAR file from which those classes can be used by the compiler and JVM?()

题型:单项选择题

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

题型:多项选择题

Given:What is the result?()

题型:单项选择题

A team of programmers is involved in reviewing a proposed design for a new utility class. After some discussion, they realize that the current design allows other classes to access methods in the utility class that should be accessible only to methods within the utility class itself.What design issue has the team discovered?()

题型:单项选择题

Click the Exhibit button.What two must the programmer do to correct the compilation errors?()

题型:多项选择题

Given:What is the result?()

题型:单项选择题