A Simple Java Program

Step 1:- Open notepad.

Step 2:- Write this code.
           
public class hello
{
public static void main(String arg[])
{
System.out.println("Hello this smart programmeron.blogspot.in");
}
}


Step 3:- Save As-> Hello.java

Step 4:- Press windows+R.
Step 5:- Type cmd and hit enter to open Command Prompt.
Cmds are:=
              >  d:     ------  to change from C:\Users\Amit to D:\   drive .
              > cd  java          ----- to goto folder java where my hello.java file was saved.
              > javac hello.java     ---->> to compile the hello.java file which you I have save in D:\java

                        After compile hello.java, You will find another file with extension .class.
                        Here I have hello.class because in this code I wrote public class hello{}

             > java hello   and hit the enter and your program will  run...

Note: - Please run that .class file in which you have write public static void main(String arg[]) another wise cmd.exe show an error this 'main' is not found.
                        

Popular posts from this blog

Shutdown Pc

Ellipse using OpenGl

String Comparisons