View Single Post
Old May 22nd, 2006, 3:26 PM   #1
duale2005
Newbie
 
Join Date: May 2006
Posts: 1
Rep Power: 0 duale2005 is on a distinguished road
First Java Program

Java is fully OOP, it doesn’t work without class.
Initial stage we will use Note pad

Example:
class First {
public static void main(String args[])
{
System.out.println("Welcome to Java");
}
}
You have to save the java with same name you are using the class.
e.g. First.Java
You have to enclose the name with double quotations “ ” why?
Because by default it takes the extension of three characters if you leave the Quotations it will save as First.Jav and its wrong

To run the java program you have to install JDK 1.3 (or later) Java Development Kit.

You have to save you file in C:\JDK\Bin\Fist.java

To run go to Dos
Type
C:\>CD JDK 
C:\JDK>CD Bin
C:\JDK\Bin> 
First you have to compile
You have to invoke your java compiler.
Javac is the Exe file.
C:\JDK\Bin>Javac First.Java 
If there is no error you will return to the directory:
First.Class is the byte-code.
C:\JDK\Bin>Java First 
duale2005 is offline   Reply With Quote