Writing Your First “Hello World” Program in Java

java hello world

How to create your first Java Program

Welcome to my blog about Java! Today I will be taking you through how to print Hello World in Java programming language which is quite easy.

You don’t need to be very good in Mathematics before you can start writing programs, you just have to be committed to learn and then write along the way. This way, programming in Java becomes easy for you.
However, you’re not on this page to become motivated. Let us take a look at how you can create a Hello World program in Java. Before we start writing the program together, here are what you’ll need to successfully write and run a simple Java program:

– Java IDE (Eclipse, Netbeans or Blue J) – I use Blue J and it’s quite advanced so I’ll recommend you download Netbeans and the Java SDK.
– Your Laptop
– Your time

And that is all – So let’s get started with writing your first java program.

java hello world

Take a close look at the image above you, it runs two programs at the same time. I purposely did this so as to make things very easy for you to understand.

1. The first program will print out “Hello World ” after compiling
2. The second program will divide X by Y and print out C where the answer is stored in the program.
Here we go; to create a new java Program, the first thing to do is to create java class, like this:

create java class

Public class NameOfClass{


Then we declare the type of program we want to run by passing a method. I kinda don’t know how to explain this part but I’m very sure in every program, you’ll write a method for your program to run and it is usually written like this:

public static void main(String[] args){


You will write this code above after declaring your java Class and inside this method is where you’ll write your first java program to print Hello World.
Compared to other languages like JavaScript where you will print to the console, java is quite different even though its syntax is closely related to other Object-Oriented programming languages. To print out a String in java, here’s how to write it out:

// My First Statement – This is a comment, disregard this

System.out.println("Hello World");

The above line when written inside the java method prints out “Hello World” and then we’ve successfully written your first java program. Isn’t that amazing? Just like that, you kick-start learning with Java.

After the whole learning, this is how your program should look like:

public class HelloWorld {
public static void main(String[] args){
// My First Statement
System.out.println("Hello World");

* This is my first java

Remember you owe your own learning and then take note that a single comma or parenthesis could make your java program fail to run. So it is advisable to keep calm and code on.

Do you like this article on how to print Hello world program in Java and what next would you love me to teach you next? Let me know in the comment box below.
You’re an amazing reader!


◊[Easy BET and WIN 100%] Click Here To Get Daily Sure Football Predictions From Team Of Experts. --CLICK HERE

◊Join 1xbit and Bet in Crypto, Receive welcome Bonus up to 7 BTC --CLICK HERE

◊Register Your Business Name With CAC and Get it in less than 2 weeks--CLICK HERE

Previous articleHuawei Nova 5i Pro Official with Quad Rear Camera, 7nm Chipset, 4000mAh Battery
Next articleBlack Shark 2 Pro Brings UFS 3.0 Storage and Snapdragon 855 Plus