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?()
A.Canada
B.null Canada
C.Canada null
D.Canada Canada
E.Compilation fails due to an error on line 26.
F.Compilation fails due to an error on line 29.
Which is true?()
A.if line 10 is removed, the compilation succeeds.
B.if line 11 is removed, the compilation succeeds.
C.if line 12 is removed, the compilation succeeds.
D.if line 13 is removed, the compilation succeeds.
E.More than one line must be removed for compilation to succeed.
What is the result?()
A.0, 0, 0
B.150, 60, 0
C.Compilation fails.
D.150, 150, 150
E.An exception is thrown at runtime.
最新试题
What is the result?()
What is the output if the main() method is run?()
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?()
What is the result?()
A programmer must create a generic class MinMax and the type parameter of MinMax must implement Comparable. Which implementation of MinMax will compile?()
Which three will compile and run without exception?()
Which two are possible results?()
What can be a result?()
A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?()
Given that t1 is a reference to a live thread, which is true?()