Wednesday, 22 June 2011

Write a Simple Java Program

First of all download Java SDK from here. Then install it.
Now open notepad or any text editor and type this code.

class example
  public static void main(String args[])

and save this file as in the bin directory (c:\j2sdk1.4.2\bin).

Now open command prompt and go to your Java directory.
Now compile your first program by typing  javac
Now the program will be compiled.
Now Run your program by typing  java example

The output of the above program will come like this.

No comments:

Post a Comment