0
Is it necessary to have a public class in every Java program?
I learned that, we must have to give the program name as same as the public class's name which we will use in the program. So, there will be multiple classes in a program as per as my requirement. So, is it necessary to put a public class in any Java program to run the program?
2 odpowiedzi
+ 6
The main method is the entry point of your program which is inside a class.
0
See in your Java program you must have to save your file name as your public class's name. So, for your programs the public class acts like the entry point. You can say that, it is mandatory!