Hello Java Example
Let's create the hello java program:
class Simple {
public static void main(String args[]){
System.out.println("Hello java")
}
}
save this file as Simple.java
To compile:javac Simple.java
To execute:java Simple
Output:Welcome to java technology.
To write the simple program, open notepad and write simple program as displayed below:
As displayed in the above diagram, write the simple program of java in notepad and saved it as Simple.java. To compile and run this program, you need to open command prompt by start -> All Programs -> Accessories ->command prompt.
To compile and run the above program, go to your current directory first; my current directory is c:\new .
Write here:
To compile:javac Simple.java
To execute:java Simple
In this page, we will learn how to write the hello java program. Creating hello java example is too easy. Here, we have created a class named Simple that contains only main method and prints a message hello java. It is the simple program of java.
Requirement for Hello Java Example
For executing any java program, you need to - 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.
Let's create the hello java program:
class Simple {
public static void main(String args[]){
System.out.println("Hello java")
}
}
save this file as Simple.java
To compile:javac Simple.java
To execute:java Simple
Output:Welcome to java technology.
To write the simple program, open notepad and write simple program as displayed below:
As displayed in the above diagram, write the simple program of java in notepad and saved it as Simple.java. To compile and run this program, you need to open command prompt by start -> All Programs -> Accessories ->command prompt.
To compile and run the above program, go to your current directory first; my current directory is c:\new .
Write here:
To compile:javac Simple.java
To execute:java Simple
0 comments:
Post a Comment