;

Java Program to Print "Hello World!"


Tutorialsrack 19/04/2021 Java

In this Java program, you will learn how to print any message on the screen. And in this java program, we print the “Hello World!” on the display. If you want to run this basic java program on your computer, make sure that Java is properly installed. Also, you need an IDE (or a text editor) to write and edit Java code. Best Java IDE 2021 | Most Popular Java IDE.

Java Program to Print "Hello World!"

Java Program to Print "Hello World!"
// Your First Program in Java

public class helloworld {

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

Hello World!!

Understand the Program

1) public class HelloWorld

Name of the public class, if there is no public class defined in the program, the class which has the main() method will be a class file after compiling the program.

2) public static void main(String []args)

This main() method is called when a program is being executed. String []args - an object of string array for compile line arguments.

3) System.out.println()

This method is used to print the text and/or values on the output screen.


Related Posts



Comments

Recent Posts
Tags