Tuesday 7 August 2018

JAVA PROGRAM STRUCTURE



Java program may contain many classes of which only one class defines a main method.
Documentation Section
The documentation section comprises a set of comment lines giving the name of the program,
and other details.
Package Statement
This statement declares a package name and informs the compiler that the classes defined
here belong to this package
Import Statement
This is similar to #include statement in c/c++
Ex: import java.io.*;
This statement instructs the interpreter to load the methods contained in the package java.io.
Interface Statement
This is an optional section and is used only when we wish to implement the multiple
inheritance feature in the program.
Class Definition
A java program may contain multiple class definitions, which contains business logic
methods.
Main Method Class
Since every Java program requires a main method as its starting point, this class is the
essential part of a java program.

No comments: