Simple basic HelloWorld JAVA Program code to print “Hello World”
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.<em> & can be imported by this code import java.lang.</em> . 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
public static void main(String ar)
How to execute the program ?
- Save as: E:\HelloWorld.java
- Open cmd: Run -> cmd
- Compile: E:\> javac HelloWorld.java
- Execute (interpreter): E:\> java HelloWorld
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]
ASK US ANYTHING !
Have Questions or just need Help ? Ask it at AskHelpy.com and get it Answered within hours.