A java programs may contains many classes. Classes contain data methods that operate on the data members of the class. A java program may contain one or more sections as given below.
It comprises a set of comment kines giving the name of the program, the author and other details with programmer would like to refer to at a later stage.
Java uses the comments style as /**..........*/ known as documentation comments.
The first statement allowed in java file is a package statement. This statement declares a package name and informs the compiler that the class defined here belong to this package.
Example: package myPackage;
This is similar to #include statement in C. Just like #include it can also used to link all the resources that are need to run your java program. For example the following statement
import java.Scanner
This statement instruct the interpreter to load the Scanner class contained in the package java.util.
The main method creates objects of various classes and established communications between them. on reaching the end of main, the program terminates and the control passes back to the operating system.
Documentation Section:
It comprises a set of comment kines giving the name of the program, the author and other details with programmer would like to refer to at a later stage.
Java uses the comments style as /**..........*/ known as documentation comments.
Package statements
The first statement allowed in java file is a package statement. This statement declares a package name and informs the compiler that the class defined here belong to this package.
Example: package myPackage;
Import statement
This is similar to #include statement in C. Just like #include it can also used to link all the resources that are need to run your java program. For example the following statement
import java.Scanner
This statement instruct the interpreter to load the Scanner class contained in the package java.util.
Interface statements
An interface is like a class but includes a group of method declarations. This is optional section.class definitions
A java program may contain multiple class definitions. class are the primary and essential elements of a java program.Main method class
The main method creates objects of various classes and established communications between them. on reaching the end of main, the program terminates and the control passes back to the operating system.
0 comments :
Post a Comment
Note: only a member of this blog may post a comment.