Display "Hello World!!!" on console
If you're just getting started with Java, one of the first programs you'll write is the classic “Hello World” example. It’s a simple program that shows how Java code is structured and how to print something to the screen. In this tutorial you'll learn how to print "Hello World!!!" on console.
What You Need
-
A text editor (like Notepad, VS Code, or IntelliJ)
-
Java Development Kit (JDK) installed on your computer
-
Command line or terminal access
Step-by-Step: Writing Your First Java Program
- Open Notepad and paste the following code in it.
class HelloWorld { public static void main(String args[]) { System.out.println("Hello World!"); } }
- Save the file as "HelloWorld.java" in some directory. As an example I have saved it in directory "C:\JavaPrograms". Note that the filename must be same as the classname containing the main method.
- Open Command Prompt and go to the directory where you have saved the program.
- To compile the Java program use the following command "javac HelloWorld.java".
- Finally to execute the program use the command "java HelloWorld". Then you will get the following output
Explanation of the Code
Now let’s break it down:
-
public class HelloWorld
– This defines a class namedHelloWorld
. In Java, every application must contain a class. -
public static void main(String[] args)
– This is the main method, where the program starts. -
System.out.println("Hello, World!");
– This line prints the text Hello World !!! to the console.
The following snapshots gives you the detailed view of the first program

Congratulations!
You've just written your first Java program. This simple example is your first step into the world of Java programming.
Comments
Post a Comment