Simple basic HelloWorld JAVA Program code to print "Hello World"
erbhaveshkumar123
erbhaveshkumar123 April 23, 2017

Promote your Mobile App in minutes with CPIDroid™

Signup now to start promoting your Android , iOS , Web app
Cheap & Fast just with your Mobile App link.

Today, I am going to write a simple basic HelloWorld Program code in java. It is the most simplest program. It will just display a message like "Hello World" on the command screen after execution.

Let me first tell you about the default package. In java there is a default package named as java.lang.  & can be imported by this code import java.lang. . This package is default and it is included automatically by default even if you do not declare it in the code.

Now, Let us code the program :-

import java.lang.*; // default package 

class HelloWorld
 {
   public static void main(String ar[])
   {
     System.out.println("Hello World");
   }
 }

 

How to execute the program ?

  1. Save as: E:\HelloWorld.java
  2. Open cmd: Run -> cmd
  3. Compile: E:\> javac HelloWorld.java
  4. Execute (interpreter): E:\> java HelloWorld

Output:

[alert-announce]Hello World[/alert-announce]

 

Journey of a Java program from Source code to Output

I have given a flow chart of java program below. It is actually the flow of execution of program including compilation and interpretation. It will help you understand that how we get output finally from initial source code.

Source code [HelloWorld.java] ---> javac [Compiler] ---> Byte code [HelloWorld.class] ---> java [Interpreter] ---> [Output]

SignUp Now to Get FREE Access to our All in One Digital Marketing Platform!

We will continue to update Front; if you have any questions or suggestions, please contact us!

Follow us on Facebook, Instagram, Twitter, Pinterest, Linkedin, YouTube, and Medium.

erbhaveshkumar123
Written by

erbhaveshkumar123

I create advanced website builders made exclusively for web developers.

3 Comments

Image Description
Dave Austin 1 day ago

As a Special Education teacher this resonates so well with me. Fighting with gen ed teachers to flatten for the students with learning disabilities. It also confirms some things for me in my writing.

Reply
Image Description
Hanna Wolfe 1 day ago

Love it Dave! We're all about keeping it up.

Reply
Image Description
Maria Muszynska 2 days ago

Since our attention spans seem to be shrinking by the day — keeping it simple is more important than ever.

Reply

Post a comment

Stay in the know

Get special offers and the latest news updates from ElanceMarket™.