Hello World Example
we will learn how to write the simple program of java. We can write a simple hello java program easily after installing the JDK.
To create a simple java program, you need to create a class that contains the main method. Let's understand the requirement first.
For executing any java program, you need to
- Install the JDK if you don't have installed it, download the JDK and install it.
- Set path of the jdk/bin directory.
- Create the java program
- Compile and run the java program
Hello World Example
- class Simplex{
- public static void main(String args[]){
- System.out.println("Hello Java world");
- }
- }
Note - here class is a keyword and Simplex is a class name. public static void main is a main function of program here exection of java program starts.System.out.println method used to print output or value on the console.
For run this program save this file with class name.java
save- Simple.java
Compile - javac Simplex .java
Execute- java Simplex