Sorry. I disagree after
testing the following program.
Jason, your assumption that "the name of source file MUST BE differenct than its class/interface" is incorrect.
Actually, it should be "MAY BE". It works fine with either of the class name defined in the file. Just try the following pgm.
Ankur, in case of presence of main() in boht classes, you might want to run each of them separately. you can do so by saying "java Myclass" or "java Yourclass".
// Name it
// Myclass.java or
// YourClass.java or
// Myjava.java
class Yourclass {
public static void main(
String[] args){
System.out.println("in main of Yourclass");
}
}
class Myclass{
public static void main(String[] args){
System.out.println("in main of Myclass");
}
}