1.Goto terminal first, now make directory using following command any where.
mkdir javaprogram
2.Create a file using vi editor by using the following command
vi HelloWorld.java
3.Now it will create HelloWorld.java and now it will open that file now press on the letter 'i' from the keyboard which inserts the text.
4.Type the following program
class HelloWorld
{
public static void main(String args[])
{
System.out.println("hello world first program");
}
}
5.Now press escape key from keyboard and then press :wq.
6. Now compile the program like this javac HelloWorld.java
7.Now run the program like this java HelloWorld