Search This Blog

#1. Java Sample Program

Open NotePad
  • From Keyboard press (windows key + R (Run as))
  • and type notepad

import java.io.*;
class SampleDemo
{
public static void main(String args[]) throws IOException
{
System.out.println("Hello world....!");
}
}


  • Go to File--->Save--->SampleDemo.java (make sure that where you are storing that suppose, in my case Desktop)
  • Open Command prompt(From keyboard press(windows-key+R)).
  • and then type as "CMD".
  • From command prompt go to that location where you store the file in my case Desktop as i mentioned above.
  • compile java program using the command 
          • javac <file-name>.java
          • javac SampleDemo.java
  • Run the program using the command
          • java <file-name>
          • java SampleDemo

No comments:

Post a Comment