Top News

What happens when static modifier is not mentioned in the signature of main method?

 

As per Java specification, main method has to be marked as static. It needs only one argument that is an array of String.

 A program can compile with a non-static method. But on execution it will give NoSuchMethodError.

Post a Comment

Previous Post Next Post