While using multiple class in the same file without any public class in java
1.You will make a file with more then one class like
class Game{
public static void main(String[] args){
System.out.print(""gaming");
}
}
class Movie{
void main(){
System.out.println("Movie");
}
}
2.Save the file with the name of class having the main method for above save it with Game.java
3.compile and run the file using the name Game
And the other one is with having a public class
1.suppose you have to classes in your file like
public class Hello{
public static void main(String[] args){
System.out.print(""hello");
}
}
class Go{
void main(){
System.out.println("GO");
}
}
2.In java you can have only one public class in a single file so,you have to save the file with the name Hello.java
3.Now you can run and compile with Hello
file name