单项选择题

Given classes defined in two different files:

What is the result of executing XMLMessage.main?()

A.text
B.Compilation fails.
C.<msg>text</msg>
D.An exception is thrown at runtime.


您可能感兴趣的试卷

你可能感兴趣的试题

1.多项选择题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 Book class?()

A.The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar
B.The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar
C.The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar/Paper.class
D.The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar
E.The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac –cp /foo/myLib.jar/Paper Book.java
F.The JAR file is located at foo/myLib.jar and the Book class is compiled using javac –classpath /foo/myLib.jar Book.java

2.单项选择题

What is the result?()

A.1,2,3
B.Compilation fails because of an error in line 12.
C.Compilation fails because of an error in line 13.
D.Compilation fails because of an error in line 14.
E.A ClassCastException is thrown at runtime.

3.单项选择题

What is the result?()

A.TestA
B.TestB
C.Compilation fails.
D.An exception is thrown at runtime.

4.单项选择题

What is the result?()

A.Compilation succeeds.
B.Exactly one class does NOT compile.
C.Exactly two classes do NOT compile.
D.Exactly four classes do NOT compile.
E.Exactly three classes do NOT compile.

6.单项选择题

Which statement is true about the class of an object that can reference the variable base?()

A.It can be any class.
B.No class has access to base.
C.The class must belong to the geometry package.
D.The class must be a subclass of the class Hypotenuse.

7.单项选择题

What is the result?()

A.Compilation fails because of an error in line 3.
B.Compilation fails because of an error in line 7.
C.Compilation fails because of an error in line 9.
D.If you define D e = new E(),then e.bMethod() invokes the version of bMethod() defined in Line 5.
E.If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.
F.If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 9.

8.多项选择题

Which three are valid on line 12?()

A.final
B.static
C.native
D.public
E.private
F.abstract
G.protected

10.多项选择题

Which two methods, inserted independently at line 17, correctly complete the Sales class?()

A.double getSalesAmount() { return 1230.45; }
B.public double getSalesAmount() { return 1230.45; }
C.private double getSalesAmount() { return 1230.45; }
D.protected double getSalesAmount() { return 1230.45; }