Java simple Program with Line by line explanation


Java Simple Program:

public class first {
public static void main(String[] args)
{
System.out.println("Hello Shivam");
}
}
Output:












Class Declaration line :-

Class First One declare the class which is Object Oriented and therefor everything must be place inner way to class . The class is keyword and declares the new class definition .
Main() Line :-

It is a main function containing many arguments

Public Static Void main(String args[]) :-

Above line similar to main like C++,A java app have any number of classes but one of them must include main method to initiate the execution .



 Public :-

The public keyword is access specifier that declare main method accessible   to all classes.
Static :-

It means this method as one that belongs to lintier class and not the part of any object of class.

Void :-

Void does not return any values .
All parameter to a declare inside as inn parenthesis string args[] declare parameter name args Which contain array of Object of the class type string .

System.out.println(“Hello”); :-

This line is use for display the massage inside the brackets (“Hello”)
   

Comments