Hello World in Java

Hello World in Java

Whenever we start learning new programming language this is the basic thing we try to learn at the beginning i.e. how to print hello world!. In this post we are going to see how to print “Hello world in Java”. Steps for executing any java program are:

  • Download the JDK and install it.
  • Set path of the jdk/bin directory
  • Create the program
  • Compile and run the program

Q. Program to print “Hello World!” in Java.

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


java output

Program parts-

  1. class– Used to declare a class in java.
  2. public– Access modifier which represents it is visible to all.
  3. static– The main method is declared as static, so it doesn’t require to create an object to invoke the main method.
  4. void– Return type of the method.
  5. main– Represents the starting point of the program.
  6. String[] args– Used for command line argument.
  7. System.out.println()– System is a class, out is the object of PrintStream class, println() is the method of PrintStream class. System.out.println is used to print a statement.


So this is how you print the basic “Hello World” in java. We hope it was clear to you. For daily updates and more such content do follow us on Instagram.

Keep programming!


Leave a Reply

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