Main method error in java

This code is valid. But to invoke it, you must execute

java PrintMsg

and not

java PrintMsg.Main

as it seems you’re doing. java expects the fully qualified name (package + class) of a class containing a main method. Your class name is PrintMsg.

Browse More Popular Posts

Leave a Comment