Skip to main content

JAVA:Structure of Java program.

JAVA.

We know about the history, features and also the environment of java. Now we will move on to the program developing.

There are two types of Java program
  • Application Program.
  • Applet Program.

Application Program:
            They are also know as Stand alone program. They are written to carry out certain task on local computer like, solving equation, read and write etc...
This can be executed in 2 Steps.
 1. To compile(translate source code into byte code) using javac compiler.
 2. To execute java interpreter.

Applet Program:
            A small program developed for internet application. Usually, applet is embedded in HTML pages in web browses. It can be downloaded by internet and can be executed using capable browser. It can be also be executed in command line using applet viewer JDK tool.

        
Before writing program we should know format to write a program. SO lets us study the structure carefully.

Structure of Java:
Structure of Java program.
Document section:
                It is a command statement. It has a set of command line or text which describes about the program you write like program name or author name or any other detail about the program.
Example:
            /* program to find student information */

Package Statement: 
                It is a statement which declares the name of the package. Those  tell compiler (translate source code into byte code)  that the classes (blueprint from which object are created) defined here belongs to this package.

Import Statement:
                import is a keyword in java language. Keywords are fixed meaning words in java program. It is used to import built-in and user-defined package into java source file.

Interface Statement:
                An interface is a reference types in java. It is similar to class. It is a collection of abstract methods. A class implements an interface, inheriting the abstract methods.

Class Definitions:
                A java program may contain multiple class definitions. Classes are primary and essential element of a java program. These classes are used to map the object of real world program. The number of classes used depends on the complexity of the problem.

Main method class:
                Every Java required a main() method as its starting points. The main() method creates object of various classes and establishes communications between them. The program get terminated by the end of the main() method.

By knowing the above structure we are able to write or develope Java program.



Comments