What happens if static modifier removed from signature of main method

What happens if static modifier removed from signature of main method

Answer: You could compile program successfully but when try to run it will give you below exception:

C:\Spring\SpringIDE\sts-bundle\sts-3.5.0.M2\workspace\PreparedStatemnetExample\bin>java com/javahonk/MainMethodTest
Error: Main method is not static in class com.javahonk.MainMethodTest, please define the main method as:
   public static void main(String[] args)

 

For more explanation please click here 

Leave a Reply

Your email address will not be published. Required fields are marked *

I am not Robot *