Presentation is loading. Please wait.

Presentation is loading. Please wait.

N. HARIKA Lecturer(csc). 3 General Structure Of A Java Program.

Similar presentations


Presentation on theme: "N. HARIKA Lecturer(csc). 3 General Structure Of A Java Program."— Presentation transcript:

1 N. HARIKA Lecturer(csc)

2

3 3 General Structure Of A Java Program

4 4 Documentation Section The documentation section comprises of a set of comment lines giving the name of the program, the author and other details.

5 5 Package Statement The first statement allowed in a Java file is a package statement. This statement declares a package name and informs the compiler that the classes defined here belong to this package.

6 6 Import Statement The next thing after a package statement may be a number of import statements. This statement instructs the interpreter to load the class from particular package.

7 7 Interface Statement An interface is like a class but includes a group of a method declarations. This is also an optional section and is used only when we wish to implement the multiple inheritance feature in the program.

8 Class A java program may contain multiple class definitions. Classes are primary and essential elements of a java program. These classes are used to map the objects of real-world problems.

9 Main Method Class Every Java Stand-alone program requires a main method. A simple java program may contains only this part. The main method creates the objects of various classes and establish the communication between them.

10

11 Save the file name as Example.java //AS class name

12 Compile as: javac Example.java Execute as: java Example

13 13 THANK YOU


Download ppt "N. HARIKA Lecturer(csc). 3 General Structure Of A Java Program."

Similar presentations


Ads by Google