In this tutorial, we will discuss how to write the hello world java program. Creating hello world java example is too easy. Here, we have created a class named MyFirstJavaProgram that contains only main method and prints a message "hello world". It is the simple program of java.
Requirement for Hello World Java Example:
- create the java program.
- install the JDK if you don't have installed it, download the JDK and install it.
- set path of the bin directory under jdk.
- compile and execute the program.
Creating hello java example:
Let's create the hello world java program:
public class MyFirstJavaProgram {
/* This is my first java program.
* This will print 'Hello World' as the output
*/
public static void main(String []args) {
System.out.println("Hello World"); // prints Hello World
}
}