This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
according to them, the answer is: Compilation succeeds, the output is BaseClass: doCommand. but I have one question. There are 2 public classes in this code (the code line is starting from 1 - 14, so I assume is a single java file). I'd say code would not even compile because only one class can be public. Am I missing something?
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Hi Andres Yes you are right Andres. Well if the code didn't specified that the two classes are in seperate files then this should be considered wrong. Secondly the code in your question starts from 1 that means the code is the complete code and doesn't has any enclosing class or whatever so moreever the question's answer in its present form should be the code doesn't compile.
Joined: Nov 27, 2001
Thanks... Yes, I was right, I emailed javacertificate.com and they updated the question. Now they are in different Java files.
I have read some books.I remember that one of those books says that you can not have two public class in a file if you use the SUN'JDK to compile the codes,but when you use other tools for example JBuilder ,that situation is acceptable.