I am studying for the Sun Java Cert exam and this problem appeared on a mock exam.
What will happen when you attempt to compile the following in a Test.java file?
class Base{
public static void main(String[] args) {
System.out.println("Hello");
}
}
public class Test extends Base{}
Well, I got it wrong but when i ran it myself it outputs "Hello." My question is...I though there could only be one default or public class in a source file. If that is true, then why is this code successful?
Thanks
JL