First JAVA program
First Program:
class Demo{
public static void main(String[] args){
System.out.println("Hello World");
}
|
Output :
Hello World!
|
Steps to write a java program:
- First you have to install jdk in your system.
- Then set the javac path :
- Copy the path where you installed the jdk.
- e.g. C:\Program Files\Java\jdk1.8.0_121\bin
- Now go to properties of my computer. In advanced menu click on environmental variable and set path.
- Now write a java program and save it with program name with .java extension.
- For compile the program we write: javac program_name;
- If program is successfully compiled then we can execute the program using following command: java program_name;
Comments
Post a Comment