+ 5
If multiple public classes are present in a Java file then error is thrown. Because the Java compiler generates a compiled file called .class file with the name as of the public class. Therefore, if multiple classes are present in our Java file, only one class must be declared as public i.e., a class in which main method is defined.