Hello World Program in Java.

"Hello World" program is the most basic program that is used to introduce any new Programming Language to a newbie. This program basically prints a "Hello World" message on your console screen.

In this article, we are going to understand the working of the "Hello World" program in Java. 

Java Program:
// Java First Program

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

In the above code, the first line of code defined a new class called HelloWorld because in Java all code must be contained within classes, so this is the starting point of our program.

The next line public static void main(String[] args) defines a main method within the HelloWorld class. The main method is the entry point for the program and is the first method that is called when the program is run. It takes an array of String objects called args as a parameter.

The next line System.out.println("Hello, world!"); to print the message "Hello, world!" to the console. The println method adds a new line character after the message, so the next line of output will start on a new line.

⚡ Please share your valuable feedback and suggestion in the comment section below or you can send us an email on our offical email id ✉ algolesson@gmail.com. You can also support our work by buying a cup of coffee ☕ for us.

Similar Posts

No comments:

Post a Comment


CLOSE ADS
CLOSE ADS