n. harika lecturer(csc). 3 general structure of a java program

13
* JAVA N. HARIKA Lecturer(csc)

Upload: darcy-nicholson

Post on 19-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

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

* JAVAN. HARIKALecturer(csc)

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

JAVA PROGRAMMING

STRUCTURE

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

3

General Structure Of A Java Program

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

4

Documentation Section

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

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

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.

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

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.

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

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.

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

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.

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

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.

Page 10: N. HARIKA Lecturer(csc). 3 General Structure Of A Java Program
Page 11: N. HARIKA Lecturer(csc). 3 General Structure Of A Java Program

Save th

e file n

ame a

s Exa

mple.ja

va

//AS cl

ass

name

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

Compile as: javac Example.java

Execute as: java Example

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

13

THANK YOU