Labels

Monday, September 28, 2015

Simple Java Program

Open Notepad and type the following:-

public class ex1
{
    public static void main(String[] args)
    {
        System.out.println("Hello Java!");
    }
}


  1. Save the file in desktop.
  2. Open cmd in windows or terminal in Linux.
  3. In windows enter cd desktop
  4. to compile enter javac <file_name>.java   //in this condition this is ex1.
  5. then enter java <file_name>   // to run the bytecode.

No comments:

Post a Comment