| Overview of Java Language |
| |
| Java Program Structure |
| |
| A Java program may contain one or more section which is as follow: |
| |
| 1. Documentation section (suggested) |
|
The documentation section comprises a set of comment line of the program, the author
and other details, which the programmer would like to refer to at a later stage. |
| |
| 2. Package statement (Optional) |
|
| This statement declares a package name and inform the
compiler that the class defined here belong to this package. |
| Ex: package student; |
| |
| 3. Import Statement (Optional) |
|
| This statement instructs the interpreter to load the specific class contained in the package. |
| Ex: import student. test; |
| |
| 4. Interface Statement (Optional) |
|
| An interface is like a class but include a group of method declarations. |
| |
| 5. Class Definitions (Optional) |
|
Classes are the primary and essential elements of Java program. These classes are used
to map the object of real world problems. |
| |
| 6. Main Method Class (Essential) |
|
As every Java stand-alone program requires a main method as its starting point, this class is the essential part of the program. |
| |
| |
|
| |
| |