单项选择题
Given classes defined in two different files:
1.package util;
2.public class BitUtils{
3.private static void process(byte[]b){}
4.}
1.package app;
2.public class SomeApp{
3.public static void main(String[]args){
4.byte[]bytes=newbyte[256];
5.//insert code here
6.}
7.}
What is required at line 5 in class SomeApp to use the process method of BitUtils?()
A.process(bytes);
B.BitUtils.process(bytes);
C.app.BitUtils.process(bytes);
D.util.BitUtils.process(bytes);
E.importutil.BitUtils.*;process(bytes);
F.SomeApp cannot use the process method in BitUtils.
相关考题
-
多项选择题
GivenafileGrizzlyBear.java: 1.package animals.mammals; 2. 3.public class GrizzlyBear extends Bear{ 4.voidhunt(){ 5.Salmons=findSalmon(); 6.s.consume(); 7.} 8.} and another file,Salmon.java: 1.packageanimals.fish; 2. 3.public class Salmon extends Fish{ 4.voidconsume(){/*dostuff*/} 5.} Assume both classes are defined in the correct directories for theft packages,and that the Mammal class correctly defines the findSalmon()method.Which two changes allow this code to compile correctly?()
A.add public to the start of line 4 in Salmon.java
B.add public to the start of line 4 in GrizzlyBear.java
C.add import animals.mammals.*;at line 2 in Salmon.java
D.add import animals.fish.*at line 2 in GrizzlyBear.java
E.add import animals.fish.Salmon.*;at line 2 in GrizzlyBear.java
F.add import animals.mammals.GrizzlyBear.*;at line 2 in Salmon.java -
单项选择题
1.public classA{ 2.public String doit(intx,inty){ 3.return"a"; 4.} 5. 6.public String doit(int...vals){ 7.return"b"; 8.} 9.} And: 25.A a=new A(); 26.System.out.println(a.doit(4,5)); What is the result?()
A.Line 26 prints "a" to System.out.
B.Line 26 prints "b" to System.out.
C.An exception is thrown at line 26 at runtime.
D.Compilation of class A will fail due to an error in line 6. -
单项选择题
A programmer needs to create a logging method that can accept an arbitrary number of arguments.Forexample,it may be called in these ways: logIt("log message 1"); logIt("log message 2”,”log message 3"); logIt("log message 4","log message 5","log message 6"); Which declaration satisfies this requirement()?
A.public void logIt(String*msgs)
B.public void logIt(String[]msgs)
C.public void logIt(String...msgs)
D.public voidl ogIt(Stringmsg1,Stringmsg2,Stringmsg3)
