0
Does all the java code have to be within public static void main(String[ ] args) { )
I was wondering if all the code in a java program has to be within ///public static void main(String[ ] args) { } similar like how it is in html and the body tag
2 Respuestas
+ 4
No...but if you are writing POJO means Plain Old Java Object Class then you need to use it. Because without main method you can't compile it and it will throw exception "main" method not found in the class.
If you are writing in back-end for web based website then no need to use.
+ 2
The main method is inside of a class. You can code outside of this class yes but it still has to be inside of some other class..
The main method is were your program begins executing.