Main Method Explaination
- At compilation time ,compiler won’t check whether our class contains main() method or not and whether it is properly declared or not.
- At runtime JVM is responsible to check main() method declaration.
- If main method is not available or it is not properly declared JVM will throw an error message saying NoSuchMethodError:main
JVM always checks main method with the following declaration .
public static void main(String args)
The below image explains main method in detail.