Given a correctly compiled class whose source code is:  pack

题目
单选题
Given a correctly compiled class whose source code is:  package com.sun.sjcp;  public class Commander {  public static void main(String[] args) {  // more code here  }  }  Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains “.“ (current directory). Which command line correctly runs Commander?()
A

 java Commander

B

 java com. sim. sjcp.Commander

C

 java com/sun/sjcp/Commander

D

 java -cp com.sun.sjcp Commander

E

 java -cp com/sun/sjcp Commander

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given:Which two, inserted at line 11, will allow the code to compile?()

A.public class MinMax<?> {

B.public class MinMax<? extends Number> {

C.public class MinMax<N extends Object> {

D.public class MinMax<N extends Number> {

E.public class MinMax<? extends Object> {

F.public class MinMax<N extends Integer> {


参考答案:D, F

第2题:

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 GrizzlyBear.java

C.add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java

D.add import animals.mammals.GrizzlyBear.*; at line 2 in Salmon.java


参考答案:B

第3题:

Given:Which three methods, inserted individually at line 14, will correctly complete class Two?()

A.int foo() { /* more code here */ }

B.void foo() { /* more code here */ }

C.public void foo() { /* more code here */ }

D.private void foo() { /* more code here */ }

E.protected void foo() { /* more code here */ }


参考答案:B, C, E

第4题:

You are working on a debug build of an application.You need to find the line of code that caused an exception to be thrown. Which property of the Exception class should you use to achieve this goal?()

  • A、Data
  • B、Message
  • C、Stack Trace
  • D、Source

正确答案:C

第5题:

( )refers to the range of computer hardware and OS platforms on which the source code of a program can be compiled and run.

A.Usability
B.Portability
C.Reliability
D.Maintainability

答案:B
解析:
可移植性指的是计算机硬件和操作系统平台的范围,在这些平台上都可以编译和运行程序的源代码。A可使用性 B可移植性 C可靠性 D可维护性

第6题:

Given:Which method will complete this class?()

A.public int compareTo(Object o){/*more code here*/}

B.public int compareTo(Score other){/*more code here*/}

C.public int compare(Score s1,Score s2){/*more code here*/}

D.public int compare(Object o1,Object o2){/*more code here*/}


参考答案:B

第7题:

Click the Exhibit button. Given:Which two statements are true if a NullPointerException is thrown on line 3 of class C? ()

A.The application will crash.

B.The code on line 29 will be executed.

C.The code on line 5 of class A will execute.

D.The code on line 5 of class B will execute.

E.The exception will be propagated back to line 27.


参考答案:B, E

第8题:

Given:10. interface Data { public void load(); }11. abstract class Info { public abstract void load(); }Which class correctly uses the Data interface and Info class?()()

A.

B.

C.

D.

E.

F.


参考答案:A

第9题:

class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()

  • A、 int foo() { /* more code here */ }
  • B、 void foo() { /* more code here */ }
  • C、 public void foo() { /* more code here */ }
  • D、 private void foo() { /* more code here */ }
  • E、 protected void foo() { /* more code here */ }

正确答案:B,C,E

第10题:

Given a correctly compiled class whose source code is:  package com.sun.sjcp;  public class Commander {  public static void main(String[] args) {  // more code here  }  }  Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains “.“ (current directory). Which command line correctly runs Commander?() 

  • A、 java Commander
  • B、 java com. sim. sjcp.Commander
  • C、 java com/sun/sjcp/Commander
  • D、 java -cp com.sun.sjcp Commander
  • E、 java -cp com/sun/sjcp Commander

正确答案:B

更多相关问题