-
Can you declare the main method as final in Java?
声明
方法 也不
Questioner:Emma Parker 2023-05-05 12:30:36
The most authoritative answer in 2024
-

-
Julian Martinez——Works at the International Finance Corporation, Lives in Washington, D.C., USA.
Sure, it
can be declared
final! It doesn't matter if it is declared
final, the JVM
will still find it and run it, and the compiler doesn't care. Yes We
can declare
main method final. If we make this
final it
can not be override.Hence we
can't use it in its child class.
read more >>
About “声明、方法、也不”,people ask:
QuesHub is a place where questions meet answers, it is more authentic than Quora, but you still need to discern the answers provided by the respondents.