Introduction To Course PT2: @garima Sharma, Geu
Introduction To Course PT2: @garima Sharma, Geu
Public – access specifier declaring method main as unprotected and accessible to all.
Static – class method , this will be called by interpreter before any objects are created, so it is
static.
Void – main method does not return any value.
String args[] – can contain array of objects of the class String.
Java Program
Structure
Sections
1. Documentation Section
Set of comments lines giving the name of the author, date and other details.
It should contain why and what of classes and how of algos.
2. Package Section
First statement is package statement. //OPTIONAL
3. Import Section
This statement instructs the interpreter to load the classes, as we have import in C.
4. Class Section
A program may contain multiple class definitions
Java Tokens
Any program is a collection of classes in Java.
A class is set of declaration statements, methods containing
executable statements.
Most of these contains expression , describing some actions
carried out on data.