+ 1

How come the main() method in java is not final?

Usually it is like this in Java: public static void main(String[] args) {} But why not this? public final static void main(String[] args) {} You don't want to override main anyway. So why not make it final?

3rd May 2017, 1:57 PM
Thanh Le
Thanh Le - avatar
3 Answers
+ 22
It can be final though. But then it'll act like a JavaFX framework and you have to add a package called Javafx.application.Application; P.S It's unsupported in the C.P :)
3rd May 2017, 2:03 PM
Dev
Dev - avatar
0
The main reason is that writing "final" is extra work. If you would have to explicitly say both, final or whatever the keyword for the opposite would be, people would likely write final more often.
4th May 2017, 5:18 AM
1of3
1of3 - avatar