class exampleprogram
{
public static void main(string args[ ])
{
System.out.println(“Hail The World !”);
}
}
attention@computerscienceexpertise.com
In the above program, the first line
class exampleprogram
{public static void main(string args[ ])class exampleprogram {System.out.println(“Hail The World
!”);}}declares a class named exampleprogram, where class is the reserve word.
This is followed by brace {, which indicates the beginning of the block of executable statements.
The third line :
public static void main(string args[ ])
defines the function main( ). The declaration of the main() function contains the following keywords:
Public, Static and Void.
The Public keyword acts as an access specifier which declares the main function to be publically accessible for other classes.
The Static definition declares that the very function or method is independent of the entire class
and does not figure as a part of any objects of the class. In the above program, the class
exampleprogram is unchanging or static, as a state. The term static means unchanging and implicitly final.
The Void is a data type modifier which defines the main() function of no return type.