Search code examples
javamethodsprogram-entry-point

In java can we declare main method as:- final synchronized strictfp


In can we declare main method as:

  • final
  • synchronized
  • strictfp

what is the meaning of the main method written above ?

final synchronized strictfp public static void main(String []args){}

Solution

  • This is a combination of multiple keywords as

    • final (Details) : As mentioned, final is used with a Java method to mark that the method can't be overridden (for object scope) or hidden (for static)

    • synchronized (Details, Details) : By using synchronized on a static method lock you will synchronize the class methods and attributes ( as opposed to instance methods and attributes )

    • strictfp (Details) : Strictfp ensures that you get exactly the same results from your floating point calculations on every platform. If you don't use strictfp, the JVM implementation is free to use extra precision where available.