Given the current directory is bigApp
, and the directory structure:
bigApp |-- classes |-- Main.class |-- com |-- Main.class |-- mypkg |-- Main.class
And the three files:
public class Main { public static void main(String[] args) { System.out.println("classes"); } } public class Main { public static void main(String[] args) { System.out.println("com"); } } public class Main { public static void main(String[] args) { System.out.println("ws"); } }
Have been compiled into the classes, com, and mypkg directories, respectively.
Which will produce the output "ws"? (Choose all that apply.)
B, C, and E
B, C, and E correctly use the classpath option ( -cp) to find the desired version of Main.class.
The ":" separates the various paths to search, and paths are searched in the order in which they appear in the command line.
A will not find any Main.class file.
D will find the "classes" version.
F will find the "com" version.