Choose Your Language

Sunday 16 December 2012

Creating and Running Your First Java Program Using Notepad

Creating and Running Your First Java Program Using Notepad

Step 1: Copy the following code into a notepad.

class FirstProgram{
 public static void main(String args[]){
     System.out.println("My First Java Program");
 }
}

Step 2: Save the file in the directory C:workspace ,  as FirstProgram.java  & not as  FirstProgram.java.txt
Step 3:  Open the command prompt. Go to Directory C:workspace . Compile the code using command,  javac FirstProgram.java

Step 4: Run the code using command, java FirstProgram
output:
 My First Java Program

No comments:

Post a Comment