How to Write Your First Java Program with Example

Simple Program of Java Language

import java.io.*;
class welcome
{
public static void main(String aa[])
{
System.out.println(“Welcome in Java programming language”);
System.out.println(“Java is developed by James Gosling”);
System.out.println(“This language was initially called as Oak”);
}
}

How to run Java Program

Compile and execute :

  1. First, we write the source code of the program in java Language using an editor like notepad.

2. Save this file as welcome.java in the bin folder using the jdk1.6.0 version.

3. Write these commands on the prompt to run the java program like below.

To compile–javac welcome.java

To execute:–java welcome

Simple Java Program