Slider

Hello World Program in Java.

In this article, we are going to understand the working of the "Hello World" program in Java. The next line System.out.println("Hello, world!"); to p
"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.

0

No comments

Post a Comment

both, mystorymag

DON'T MISS

Nature, Health, Fitness
© all rights reserved
made with by AlgoLesson
Table of Contents