HelloWorld In JAVA

  • Avatar
  • January 6, 2020
  • 5 0

In programming language, programmer start a program with Hello World. Every programming language including python , javascript, HTML and so on used Hello world as a beginner basic program.

Like other programming language, in java, programmer starts with hello world. Moreover, Java is a bit complex as compared with other programming language but with lots of practice and dedication, it will be easy. So, here we are going to start our first program in java.

It consists of three primary components:- class definition, the main method and code comments. The given instruction will help you to understand code easily:-


The class defines to declare that new class is being defined. Without class, program cannot be execute in java.

First line

HelloWorld is the class name which is also known as identifier. The entire definition of class is between curly brace ({ }). First curly braces is known as starting point and second curly brace is known as ending point.

Main method:- Main method is mandatory in java programming.

Public:- JVM can execute method from anywhere.

Static:- Without object main method.

Void:- it is non-return type which doesn’t return value.

Main():- Name configured in JVM

String:- main method accepts a single arguments.

second line

Here, Input data should be in between curly brace of main method. We cannot perform a program without main method.


It prints the given input. The built-in println( ) method accomplishes output.

Third line

The printin() method print the line.



It is either multiline or Single line comment.



After writing code, JVM compile the program and gives meaningful output.


Here is the output of the given program.


This is the first program in Java. Here, the main thing you need to understand is definition of class, main method and printin() method. Hope you get to know something about HelloWorld.


Lattice Nepal is an online magazine for global readers. Get timely updates about world affairs, wonderful facts, and trustworthy news.

Leave a Reply

Your email address will not be published. Required fields are marked *