can main be marked final, native, strictfp or synchronized whats the logic / purpose + are final ,native, strictfp or synchronized inheritated and checked while overloading or overriding whats the rule
The "logic/purpose" in making a main method final, strictfp, or synchronized is the same as in making any other method final, strictfp, or synchronized. In general, final methods cannot be overridden; strictfp methods have consistent floating point behavior across different platforms; and synchronized methods cannot be executed unless the calling thread obtains the object/class lock.
I don't know whether main (as a Java entry point) can be native.
Because methods are identified by their (fully qualified) class name, method name, and ordered argument types, overloading is just a variation in naming. From the compiler's perspective, overloaded methods are unrelated. So the modifiers final, strictfp, synchronized, and native have no relevance to overloading. Also, an overloaded version of main (with some argument other than a String array) will not function as an entry point.
final methods are inherited, but -- by definition -- cannot be overridden. (If you want a method to be "invisible" to a subclass, use private.)
The synchronized modifier is not passed via inheritance. [ January 10, 2005: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Of course this goes back to the issue of how static methods are not really overridden, but rather 'hidden'.
making a main method final, really wouldn't seem to do much.
Actually, final works the same for a static method. It prohibits the hiding of an inherited static method by a method in a subclass. BTW, the JLS distinguishes hiding, as I defined it, from shadowing, giving a member the same name as a member in an enclosing scope.
SCJP 1.4, SCWCD in process
Joined: Dec 29, 2004
I apoligise. It looks like I was wrong. Good thing there are smart people here to correct me.