Java Scrap Book  

Java Scrap Book > First Java Program

Phases of a Java Program Development

  1. Write the java program
  2. Compile the Java program
  3. Run the java program

First Java Program

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

There are two ways to write java code.

  1. Use text editor of your choice and command line Java tools such as "javac" and "java"
  2. Use IDE (Integrated Development Environment)
    1. Eclipse
    2. NetBeans
    3. Intellij IDEA


Step to compile and run java program using text Editor and Command line tool

  1. Using text editor,write above java program
    > name it "Hello.java"
  2. Compile the Java program
    > javac Hello.java
  3. Run the Java program
    > java Hello

Step performed at Java Runtime

  1. After compiling when you will try to run the byte code (.class file), the following steps are performed at runtime
  2. Class loader loads the java class.It is subsystem of JVM(Java Virtual Machine)
  3. Byte Code verifier checks the code fragments for illegal code that can violate access right to object.
  4. Interpreter read the byte code stream and the executes the instruction


Copyright © 2013-2017

javascrapbook.com is a computer science content service should not be treated as the publisher or speaker of any information provided by another Computer Science content provider.

Contact email: javascrapbook2013@gmail.com