多项选择题

Which three are valid on line 12?()

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


您可能感兴趣的试卷

你可能感兴趣的试题

2.多项选择题

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; }

3.多项选择题

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.

4.多项选择题

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;

5.单项选择题

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.

6.单项选择题

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

7.多项选择题


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

8.单项选择题

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.

9.单项选择题

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;

10.单项选择题

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.