Java 25: Changes to main method rules

As of Java 25, the main method no longer needs to be public or static, and it need not have a parameter of type String[] args Here are the complete rules for main methods 1. If there is more than one main method, static main methods are preferred over instance methods. 2. Methods with a String[] parameter are preferred over those with no parameters. 3. Private main methods are not considered. 4. If main is not static, the class must have a non-private no-argument constructor #Java25 #Java #Programming

Like
Reply

To view or add a comment, sign in

Explore content categories