Java uses public static void main as an entry point.
Create a Java file that has the above function.
E.g. file is given below.
/* HelloWorld.java
*/
public class HelloWorld
{
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
Now compile the above code as given below.
javac HelloWorld.java
Run the code as given below
java HelloWorld