Hello world!

The purpose of a hello world program is to give an insight into how code is magically transformed into a simple program printing a "hello world" message. The following code written in java is an example of hello world program.

This code is composed of a java Class representing a structure that contains the entry point for the java platform to execute the main code. this entry point is a function often called the Main function.

First and Foremost, to be able to run that code, you need to compile it with the Java CompilerThe java compiler transforms java code into an intermediate low-level code known as BytecodeThis intermediate code is interpreted into a running application by using the java Runtime Interpreter.

  • Javac is the java compiler tool. 
  • Java is the java Runtime interpreter.

These tools can be found in the JDK that stands for java Development Kit. The JDK contains a set of tools used for java development, execution and debugging purposes. it can be downloaded from the official site of oracle. 

here is the command that compiles the previous code and generates a HelloWorld.class file containing the byte code

  • javac HelloWorld.java

The following command line interprets the Bytecode into a running application.

  • java HelloWorld

Don't forget to remove the extension .class from the filename in front of the interpreter and to be in the directory of the bytecode file before executing the command.

The output should be

  • Hello world !

Sometimes, your program awaits for arguments to be passed to it.
Note that in most modern IDEs, you won't need to type those commands manually, instead, you will just have to configure your IDE with the appropriate JDK and compile and run your application 
conveniently through buttons.

Arguments are passed to the program as follows 

  • java HelloWorld ismail

the program now prints 

  • Hello ismail