class helloworld
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}
Output :-
To create a Java Program ,
First , We have to create a Class, and assign the Name for your java program.
Second , We have to write "public static void main(String args[])"
Public :- Public is an Access modifier, If we use public access specifier. It will be easy access the method . If we make the main() method public makes it globally available.
Static :- Static is a keyword , Which is when associated with a method , it is a class related method. If we make main method Static ,JVM can invoke it without instantiating the class.
Void :- Void is a keyword, basically void means Nothing . It used to specify that a method doesn’t return anything.
Main :- It is a java main method. It’s not a keyword. It is basically a identifier that JVM look for as the starting point of the java program.
String[] args:- It stores Java command line arguments and is an array of type java.lang.String class.
Third, We have to type System.out.println("Hello World"), Which is a Java statement that prints the argument passed, into the Statement.