A Hello, World! is a simple program that outputs Hello, World! on the screen. Since it's a very simple program, it's often used to introduce a new programming language to a newbie. Let's explore how Java Hello, World! program works.
If you want to run this 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. Any text editor may be used for writing Java programs. In Windows Notepad can do well. However, most of the developers use a certain advanced text application called Notepad++. Visit https://notepad-plus-plus.org/downloads/ for latest version of Notepad++. The steps for writing and executing Hello World! Java program.
The code inside the Notepad++ for Hello World! application can be as below.
If you have copied the exact code, you need to save the file name as HelloWorld.java. It's because the name of the class and filename should match in Java.
Go to the terminal use the following command
The command
should be able to produce the output "Hello, World!" inside CMD in Windows. This is world which is there in the listing 2.1.