0
main method() in java is always in public class.
Why is it necessary to have main method always in public class for compilers like netbeans? Also if we use online compiler sometimes it's not necessary.
5 Respostas
+ 2
because main is the entry point of your program, so it needs to be visible from outside your class
+ 2
can to link me to any of those?
0
But why in many online compilers if we not mention public in class of main() still the program runs.?
0
Try Dcoder app which compiles online.