Write a program to print hello world in Java

Write a program to print hello world in Java
Like Tweet Pin it Share Share Email

The very first program which any person would attempt when learning a programming language is to print “Hello World!”, today in this article you would learn how to print “Hello World!” in a simple Java Program.

// Importing default package
import java.lang.*;

//code for writing a class.
public class HelloWorld

    public static void main(String rs[])
        System.out.println("Hello World!");

You could run the program by opening a command prompt and then navigate to the place where the program “HelloWorld.java” is stored and used commands to compile and run the Java program, you would see the following out put.

Output: On the console / command prompt.

Hello World!

If you are not aware of how to compile, run and even create a java file, please refer to Getting started with Java , Kindly share any of your queries in form of comments, we would be more than happy to help.

Comments (0)

Leave a Reply

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