• home
  • forum
  • my
  • kt
  • download
  • Creating First Program in JAVA

    Author: 2009-03-04 09:32:56 From:

    This is very first Hello World Program written in java , it will introduce you basic structure and syntax of java program.

    What You need ?
    1. Install JVR ( Java Vartual Machine )
      JVR is environment, required for running Java Programs on your Computer.

    2. Install J2SDK ( Java Software Development Kit )
      JSDK is development kit which include JAVA Compiler for compiling your java program.

    3. Note Pad
      Note pad or Word pad is required for Writing Java Programs.

    4. DOS
      Java programs are Compiled through DOS.

    Your First Hellow World Program

    class HelloWorld 
    {
     public static void main(String[] arguments)
       {
       System.out.println("Hello World !!!");
       }
    }
    How Compile and Run Java Program
    • Copy above program in Notepad
    • Now save program as helloworld.java in Bin Folder where java J2SDK is installed
    • Open Dos Command Prompt
    • Set the path of Bin folder
      example:-
      C:\j2sdk\bin\

    • compile Java Program
      example:-
      C:\j2sdk\bin\javac helloworld.java

    • If no error Java will create class file
    • Run java Program
      example:-
      C:\j2sdk\bin\java helloworld

    • Output will be
      example:-
      Hello World !!!

    Class

    The class statement is the way you give your computer program a name. It’s also used to determine other things about the program, as you will see later. The significance of the term class is that Java programs also are called classes.

    What the main Statement Does

    The next line of the program is the following:

    public static void main(String[] arguments)
     {
     }

    This line tells the computer, “The main part of the program begins here.” Java programs are organized into different sections, so there needs to be a way to identify the part of a program that will be handled first.

    The main statement is the entry point to most Java programs. The exceptions are applets, programs that are run in conjunction with a World Wide Web page, and servlets, programs run by a web server. Most programs you will write during upcoming hours use main as the starting point.

    discuss this topic to forum

    relation tutorial

    No information

    Category

      Applet Building (6)
      Application Building (6)
      Communication (1)
      Database Related (10)
      Development (13)
      EJB (14)
      Game Programming (5)
      General Java (62)
      Javabeans (4)
      JSP and Servlets (8)
      Miscellaneous (28)
      Networking (1)
      Security (2)
      Swing (13)
      WAP and WML (2)
      XML and Java (4)

    New

    Hot