Java - Hello World Program

Views: 21   

Following is a simple Hello World program in Java.

class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!");

Let me explain to you what we just written. Don't worry if you don't get it fully. In further tutorials you will learn in detail.

class HelloWorld

class - class keyword used to create a new class.
HelloWorld - The name of your class, This also will be the name of your Java File.

public static void main(String[] args)

public - This is an access specifier, if it's public then that member can be accessed by the outside code also.
static - This allows main() to run with out creating an instance
void - This is the return type, void means it returns nothing
main() - This is the starting point of any Java program

On By