Can a class file have two classes?

You can use at most one public class per one java file (COMPILATION UNIT) and unlimited number of separate package-private classes. Compilation unit must named as public class is. You also can have in your public class the unlimited number of inner classes and static nested classes .

Sizin İçin Seçtik  What is the minimum number of classes in a Java program?

Leave a Reply

Your email address will not be published. Required fields are marked *