Is the main method needed to write a java program?
This is my code:
package example;
public class HelloWorld {
public HelloWorld() {
}
public String getHelloWorld() {
return "Hello From Java!";
}
}
It shows an error at compilation:
java.lang.NoSuchMethodError: main
Exception in thread "main"
Without a main
method you application will have no entry point. Yes, it is required for any executable program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With