Display "Hello World!!!" on console

In this tutorial we have print "Hello World!!!" on console. This is very simple Java program. The steps to write and run first Java program are:
  1. Open Notepad and paste the following code in it.
    class HelloWorld {
     public static void main(String args[]) {
      System.out.println("Hello World!");
     }
    }
    
  2. Save the above file as "HelloWorld.java" in some directory. As an example I have saved it in directory "C:\JavaPrograms"Note that the filename must be same as the classname containing the main method.
  3. Open Command Prompt and go to the directory where you have saved the program.
  4. To compile the Java program use the following command "javac HelloWorld.java".
  5. Finally to execute the program use the command "java HelloWorld". Then you will get the following output












The following snapshots gives you the detailed view of the first program

Comments

Popular posts from this blog

Program to define a class 'employee' with data members as empid, name and salary. Accept data for 5 objects using Array of objects and print it.

Define a class Student with four data members such as name, roll no.,sub1, and sub2. Define appropriate methods to initialize and display the values of data members. Also calculate total marks and percentage scored by student.

Program to draw Smiley in Applet