Hello World Program

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


Output:

Hello World!

Explanation:

 In Java everything is class and object. We can name our class pretty much what we want, there is no restriction. However, the best programming practice is to start your class name with the upper case and the subsequent word should be the upper case as well so that it will be much more readable.

In order to run and execute any java class we need a main method in it. So, we need to remember the syntax of the "main" method. In order to print something into the console we need a print method and the way we can use is by calling the System class. And, finally into the parenthesis we can type pretty much what we want.

Please share your thoughts if you have any questions.

1 comment:

  1. Thanks for the post, I am techno savvy. I believe you hit the nail right on the head. I am highly impressed with your blog. It is very nicely explained. Your article adds best knowledge to our Java Online Training from India. or learn thru Java Online Training from India Students.

    or learn thru JavaScript Online Training from India. Appreciating the persistence you put into your blog and detailed information you provide. Kindly keep blogging.

    ReplyDelete