Translate

Tuesday 12 August 2014

Hello world program in java

class Demo
{
    public static void main(String args[])
    {
        System.out.println("Hello World!!");
    }
}


Use command prompt to run java. Please Download java as shown in
http://javaproglearner.blogspot.in/2014/08/java-lets-start.html

Also set environment variable as shown.
Open My Computer-> Properties-> Advanced System Settings-> Advanced -> Environment Variables
        -> user variables -> New ->
Now give variable name = Path
variable value = c/program files/java/jdk/bin                  (Path of java/jdk/bin in your computer)

Now to execute this program open command prompt in your windows PC and enter

c:> javac Demo.java
c:> java Demo

No comments:

Post a Comment

Total Pageviews