Understanding Hello World Program

Hello World Description

In the previous tutorial you learned how to write hello world in java.
Syntax of the program was:
Access_specifier Access_Modifier Return_type main()
We will learn about the why we wrote all this in our program.

public class Print {
public static void main(String[] args) {
System.out.println(“Hello, World”);

Declaring Class

In the object oriented approach, everything begins with a class.Every
method or variable is a part of the class.In fact object is an instance of
a class.The public word specifies the accessibility of the class. The
accessibility of a class or function can be public, private or
The following code declares a new class “Print” with
the public accessibility.

Main Function

The main function is the starting point in the Java program and java
program can’t run without main.JVM calls the main method of the class.
This method is always first thing that is executed in a java program.
main method:

public static void main(String[] args)

Static Keyword

Static keyword indicates that the method is a class method, which can be
called without the requirement to create an object of the class.The keyword
static has other implementations such as declaring variables and functions

Return Type

Every function returns a value when it is executed. The returned value
is catched in a variable if necessary.There are different return types of a function such as int,float etc.In the helloworld program we used ‘void’ which
means that the function does not return a value.