public void main(String[] args) {
System.out.println("Hello World!");
}
This compiles in my environment, but nothing happens at run time.
public void main(String[] args) {
System.out.println("Hello World!");
}
This compiles in my environment, but nothing happens at run time.
If should be a static method, otherwise it can't serve as the entry point of a Java application.
public static void main(String[] args)
------
{
System.out.println("Hello World!");
}
The main method should be : public static void main(String[] args)
main() method syntax is,
public static void main(String[] args)
you are missing static, so JVM not able to find your main() method i.e. entry point so there is noting happened.
Check your console It should display error message as
java.lang.NoSuchMethodError: main
Exception in thread "main"