public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
In Java everything is class. Every Class resides in a .java file. As opposed to C where there are no classes.
Please note the “Public” keyword in 1st and 2nd line. Also notice “static” key word.
A “main” method is the entry point and that were code starts executing. In case of java a main method should always be static.
Please check “C – Helloworld” for the “void main” explanation .
Output:
