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)- A15% (9)
- B72% (44)
- C8% (5)
- D3% (2)
- E2% (1)
Community Discussion
No community discussion yet for this question.