nerdexam
Oracle

1Z0-851 · Question #237

Given a correctly compiled class whose source code is: 1. package com.sun.sjcp; 2. 3. public class Commander { 4. public static void main(String[] args) { 5. // more code here 6. } 7. } Assume that…

The correct answer is B. java com.sun.sjcp.Commander. See the full explanation below for the reasoning.

Question

Given a correctly compiled class whose source code is: 1. package com.sun.sjcp; 2. 3. public class Commander { 4. public static void main(String[] args) { 5. // more code here 6. } 7. } 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?

Options

  • Ajava Commander
  • Bjava com.sun.sjcp.Commander
  • Cjava com/sun/sjcp/Commander
  • Djava -cp com.sun.sjcp Commander
  • Ejava -cp com/sun/sjcp Commander

How the community answered

(61 responses)
  • A
    15% (9)
  • B
    72% (44)
  • C
    8% (5)
  • D
    3% (2)
  • E
    2% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice