Hello world example in Java

hello world java program

Hello world example in Java

In this tutorial, I will explain a simple Java program and it’s internal details. How program works internally and some general terms.

Before we begin make sure you are ready to run java program on your local machine. If not follow this Setting Up environment for Java tutorial to setup your local system to run java programs.

If everything is ready, then create a new folder any where on your machine like helloworld. As below :

hello world example in java


Now open command prompt and follow the instructions as below :

hello world example in java


Now let’s take a look on program structure 

hello world java program


What’s happening internally



Internal process

  • We write code in Java language.
  • Java file is then passed to the Java compiler as input (javac FileName.java).
  • Compiler then generates byte code which is actually a .class file.
  • Byte code is then passed to the JVM as input (java FileName).
  • JVM then first load that class into memory area.
  • After that JVM verifies the content as per Java Language Specification.
  • After that it goes to Interpreter and Interpreter generates code which machine can run and execute.
  • Finally output is generated and written on Standard Stream.

Leave a Reply

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