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.
您可能感兴趣的试卷
你可能感兴趣的试题
Which three are valid on line 12?()
A.final
B.static
C.native
D.public
E.private
F.abstract
G.protected
A.1
B.2
C.3
D.4
E.5
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; }
Which two are true?()
A.The output is mm.
B.The output is mc.
C.Component is-a Meter.
D.Component has-a Meter.
E.DeluxeThingy is-a Component.
F.DeluxeThingy has-a Component.
Which three are valid?()
A.p0=p1;
B.p1=p2,
C.p2=p4;
D.p2=(ClassC)p1;
E.p1=(ClassB)p3;
F.p2=(ClassC)p4;
What is the result?()
A.b,3
B.b,8
C.b,13
D.f,3
E.f,8
F.f,13
G.Compilation fails.
H.An exception is thrown at runtime.
Given two files, GrizzlyBear.java and Salmon.java:
If both classes are in the correct directories for their packages, and the Mammal class correctly defines the findSalmon() method, which change allows this code to compile?()
A.add import animals. mammals.*; at line 2 in Salmon.java
B.add import animals.fish.*; at line 2 in GrizzlyBearjava
C.add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java
D.add import animals. mammals.GrizzlyBear*; at line 2 in Salmon.java
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 command line 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
F.java com.company.application.MainClass if run from the /apps/com/company/application directory
Given the following directory structure:
And the following command line invocation:
javac –d classes source/Utils.java
Assume the current directory is bigProject, what it 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.
Which code, inserted at line 16, will cause a java.lang.ClassCastException?()
A.Alpha a=x;
B.Foo f=(Delta)x;
C.Foo f=(Alpha)x;
D.Beta b=(Beta)(Alpha)x;
最新试题
What is the result?()
What is the output if the main() method is run?()
What is the result?()
Which three will compile and run without exception?()
What is the result?()
Given that Triangle implements Runnable, and:Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to temporarily pause and allow the other thread to execute?()
What is the result?()
What is the result?()
What is the appropriate definition of the hashCode method in class Person?()
A programmer must create a generic class MinMax and the type parameter of MinMax must implement Comparable. Which implementation of MinMax will compile?()