Java Language / Structure Of Java Program

Java program consists of 6 sections.They were

Section Name Purpose
Documentation Section Used to improve the readability of the program
Package Statement Used to create a libraries (Classes and interfaces)
Import Statement It is used to access the package methods, constructors e.t.c
Interface Section Used to declare interfaces.
Class Definition It is used to create classes
Main Method Class Used to execute the classes / Execution starts from this class.

Example
Program Output
public class hw
{

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

}

Hello World

Explanation
Creating the program Open note pad and save it with hw.java
Compiling Javac hw.java
Executing the program Java hw
Javac Compiler
Java Interpreter


Home     Back