Can a main method be declared final?

Can a main method be declared final?

Hi,

Can a main method be declared final?

Thanks

View Answers

April 11, 2013 at 12:13 PM

Hi,

Yes we can. The final method can be declare as follows:

public final String convertCurrency()

The final method can't be override in a subclass.

for more about main method be declared final in Java

Ads









Related Tutorials/Questions & Answers:
Can a main method be declared final?
Why is the main method declared static?
Advertisements
What if the main() method is declared as private?
Should a main method be compulsorily declared in all java classes?
Can a method inside a Interface be declared as final?
Can a method inside a Interface be declared as final?
Can a main method be overloaded?
main method
main method
Can a class be declared as protected?
main() method
Can a class be declared as static?
Is main method compulsory in Java?
What is the return type of the main method?
java sleep in main method
java sleep in main method
What is the arguement of main method?
Can a abstract class be declared final?
When is java main method called?
What is the first argument of the String array in main() method?
ModuleNotFoundError: No module named 'nester_al_ali_finall'
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method
Accessing non-static members through the main method in Java.
Why we should use string args[] in main method in java?
Can I have multiple main() methods in the same class?
What is Public static void main

Ads