Hi Guys,
After practice a lot of questions about classpath, I created the below question by myself and would like to share with you.
I don't know if questions like the below one are on the exam, anyway, I think it still is a good question.
Here we go ...
For the question below consider using the
Java version 1.5
Given the directory structure :
And these two files :
And the two command lines from within source directory :
javac -source 5 com/scjp5/CustomMessageMain.java
java -classpath . com.scjp5.CustomMessageMain
Which version of CustomMessage.class file will be used when run the code :
a) The class version within source/com/scjp5/classes folder
b) The class version within My_Custom_Classes.jar file
c) The CustomMessageMain.java file will never compile because a compile error.
d) The CustomMessageMain.java file will never compile because
CustomMessage.class file cannot be found.
e) A NoClassDefFoundError exception will throw at runtime