ain.java file must have public class with name 'Main' You must declared Main class which contains 'main' method, which is entry point of program execution. code example
Example 1: java define main function
public class Program {
public static void main(String[] args){
System.out.println("Hello, World!");
}
}
Example 2: main method java
public class Test {
static void main(String[] args){
System.out.println("Hello World");
}
}