SlideShare a Scribd company logo
JAVA PROGRAMSTRUCTURE
 A Java Program may contain many classes of
which only one class defines a main method .
Classes contain data members and methods that
operate on the data members of the class.
Methods may contain data type declarations and
executable statements.
DocumentationSection:
The documentation section comprises a set of
comment lines giving the name of the program. Comments
must explain why and what of classes and how of
algorithms. Java also uses a third style of comment/**….*/
known as documentation.
Package Statement:
This Statement declares a package name and
informs the compiler that the classes defined here
belong to this package.
Example : package student;
The Package statement is optional.
ImportStatements:
This is similar to #include Statement in C.
import student. test;
This Statement instructs the interpreter to load the test
class contained in the package student.
InterfaceStatements:
An interface is like a class but include a group of
method declarations. This is also an optional section and
is used only when we wish to implement the multiple
inheritance feature in the program.
Class Definitions:
A Java Program may contain multiple class
definitions. Classes are primary and essential elements
of a Java Program.
Main Method Class:
A Main method as its starting point, this class is
the essential part of a Java Program. A Simple Java
Program may contain only this part. The main method
creates objects of various classes and establishes
communication between them.

More Related Content

What's hot

java interface and packages
java interface and packagesjava interface and packages
java interface and packages
VINOTH R
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
VINOTH R
 
Finalize() method
Finalize() methodFinalize() method
Finalize() method
Jadavsejal
 
Exception Handling in Java
Exception Handling in JavaException Handling in Java
Exception Handling in Java
lalithambiga kamaraj
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
Farooq Baloch
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVAAbhilash Nair
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
HalaiHansaika
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
Spotle.ai
 
Files in java
Files in javaFiles in java
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
Ritika Sharma
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Methods in java
Methods in javaMethods in java
Methods in java
chauhankapil
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
rprajat007
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
Nilesh Dalvi
 
Wrapper classes
Wrapper classes Wrapper classes
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
Vishal Patil
 
Java exception handling
Java exception handlingJava exception handling
Java exception handlingBHUVIJAYAVELU
 

What's hot (20)

java interface and packages
java interface and packagesjava interface and packages
java interface and packages
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Finalize() method
Finalize() methodFinalize() method
Finalize() method
 
Exception Handling in Java
Exception Handling in JavaException Handling in Java
Exception Handling in Java
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Type casting in java
Type casting in javaType casting in java
Type casting in java
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
Files in java
Files in javaFiles in java
Files in java
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
 
Methods in java
Methods in javaMethods in java
Methods in java
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
Wrapper classes
Wrapper classes Wrapper classes
Wrapper classes
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 

Similar to Java program structure

Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
Madishetty Prathibha
 
Annotations
AnnotationsAnnotations
Annotations
swapna reniguntla
 
Packages,static,this keyword in java
Packages,static,this keyword in javaPackages,static,this keyword in java
Packages,static,this keyword in java
Vishnu Suresh
 
Annotations in Java with Example.pdf
Annotations in Java with Example.pdfAnnotations in Java with Example.pdf
Annotations in Java with Example.pdf
SudhanshiBakre1
 
Packages,interfaces and exceptions
Packages,interfaces and exceptionsPackages,interfaces and exceptions
Packages,interfaces and exceptions
Mavoori Soshmitha
 
Oop in kotlin
Oop in kotlinOop in kotlin
Packages and interface
Packages and interfacePackages and interface
Packages and interface
KarthigaGunasekaran1
 
Z blue interfaces and packages (37129912)
Z blue   interfaces and  packages (37129912)Z blue   interfaces and  packages (37129912)
Z blue interfaces and packages (37129912)
Narayana Swamy
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2Raghu nath
 
Chapter 5 declaring classes & oop
Chapter 5 declaring classes  & oopChapter 5 declaring classes  & oop
Chapter 5 declaring classes & oopsshhzap
 
Java syntax-and-grammars-oct8
Java syntax-and-grammars-oct8Java syntax-and-grammars-oct8
Java syntax-and-grammars-oct8
MISSIASABTAL1
 
Java features
Java featuresJava features
Java features
Prashant Gajendra
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
Andhra University
 
Packages in java
Packages in javaPackages in java
Packages in java
jamunaashok
 
Packages in java
Packages in javaPackages in java
Packages in java
Jancypriya M
 
The Java Learning Kit Chapter 5 – Methods and Modular.docx
The Java Learning Kit Chapter 5 – Methods and Modular.docxThe Java Learning Kit Chapter 5 – Methods and Modular.docx
The Java Learning Kit Chapter 5 – Methods and Modular.docx
arnoldmeredith47041
 
PCSTt11 overview of java
PCSTt11 overview of javaPCSTt11 overview of java
PCSTt11 overview of java
Archana Gopinath
 

Similar to Java program structure (20)

Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
 
Annotations
AnnotationsAnnotations
Annotations
 
Packages,static,this keyword in java
Packages,static,this keyword in javaPackages,static,this keyword in java
Packages,static,this keyword in java
 
Annotations in Java with Example.pdf
Annotations in Java with Example.pdfAnnotations in Java with Example.pdf
Annotations in Java with Example.pdf
 
Unit 4 Java
Unit 4 JavaUnit 4 Java
Unit 4 Java
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
Packages,interfaces and exceptions
Packages,interfaces and exceptionsPackages,interfaces and exceptions
Packages,interfaces and exceptions
 
Oop in kotlin
Oop in kotlinOop in kotlin
Oop in kotlin
 
Packages and interface
Packages and interfacePackages and interface
Packages and interface
 
Z blue interfaces and packages (37129912)
Z blue   interfaces and  packages (37129912)Z blue   interfaces and  packages (37129912)
Z blue interfaces and packages (37129912)
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
 
Chapter 5 declaring classes & oop
Chapter 5 declaring classes  & oopChapter 5 declaring classes  & oop
Chapter 5 declaring classes & oop
 
Java syntax-and-grammars-oct8
Java syntax-and-grammars-oct8Java syntax-and-grammars-oct8
Java syntax-and-grammars-oct8
 
Java features
Java featuresJava features
Java features
 
Packages and interfaces
Packages and interfacesPackages and interfaces
Packages and interfaces
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Packages in java
Packages in javaPackages in java
Packages in java
 
The Java Learning Kit Chapter 5 – Methods and Modular.docx
The Java Learning Kit Chapter 5 – Methods and Modular.docxThe Java Learning Kit Chapter 5 – Methods and Modular.docx
The Java Learning Kit Chapter 5 – Methods and Modular.docx
 
PCSTt11 overview of java
PCSTt11 overview of javaPCSTt11 overview of java
PCSTt11 overview of java
 
Unit 2 notes.pdf
Unit 2 notes.pdfUnit 2 notes.pdf
Unit 2 notes.pdf
 

More from shalinikarunakaran1

Data Communication and Networking ( Guided and Unguided Media)
Data Communication and Networking ( Guided and Unguided Media)Data Communication and Networking ( Guided and Unguided Media)
Data Communication and Networking ( Guided and Unguided Media)
shalinikarunakaran1
 
Character generation
Character generationCharacter generation
Character generation
shalinikarunakaran1
 
Character attributes
Character attributesCharacter attributes
Character attributes
shalinikarunakaran1
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
shalinikarunakaran1
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
shalinikarunakaran1
 
Video display devices
Video display devicesVideo display devices
Video display devices
shalinikarunakaran1
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
shalinikarunakaran1
 
Introduction , surveuy on cg
Introduction , surveuy on cgIntroduction , surveuy on cg
Introduction , surveuy on cg
shalinikarunakaran1
 
Java tokens
Java tokensJava tokens
Java tokens
shalinikarunakaran1
 
Simple java program
Simple java programSimple java program
Simple java program
shalinikarunakaran1
 
How java differs from c and c++
How java differs from c and c++How java differs from c and c++
How java differs from c and c++
shalinikarunakaran1
 
JAVA HISTORY
JAVA HISTORYJAVA HISTORY
JAVA HISTORY
shalinikarunakaran1
 
JAVA FEATURES
JAVA FEATURESJAVA FEATURES
JAVA FEATURES
shalinikarunakaran1
 

More from shalinikarunakaran1 (13)

Data Communication and Networking ( Guided and Unguided Media)
Data Communication and Networking ( Guided and Unguided Media)Data Communication and Networking ( Guided and Unguided Media)
Data Communication and Networking ( Guided and Unguided Media)
 
Character generation
Character generationCharacter generation
Character generation
 
Character attributes
Character attributesCharacter attributes
Character attributes
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
Video display devices
Video display devicesVideo display devices
Video display devices
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
 
Introduction , surveuy on cg
Introduction , surveuy on cgIntroduction , surveuy on cg
Introduction , surveuy on cg
 
Java tokens
Java tokensJava tokens
Java tokens
 
Simple java program
Simple java programSimple java program
Simple java program
 
How java differs from c and c++
How java differs from c and c++How java differs from c and c++
How java differs from c and c++
 
JAVA HISTORY
JAVA HISTORYJAVA HISTORY
JAVA HISTORY
 
JAVA FEATURES
JAVA FEATURESJAVA FEATURES
JAVA FEATURES
 

Recently uploaded

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 

Recently uploaded (20)

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

Java program structure

  • 2.  A Java Program may contain many classes of which only one class defines a main method . Classes contain data members and methods that operate on the data members of the class. Methods may contain data type declarations and executable statements.
  • 3. DocumentationSection: The documentation section comprises a set of comment lines giving the name of the program. Comments must explain why and what of classes and how of algorithms. Java also uses a third style of comment/**….*/ known as documentation. Package Statement: This Statement declares a package name and informs the compiler that the classes defined here belong to this package. Example : package student; The Package statement is optional.
  • 4. ImportStatements: This is similar to #include Statement in C. import student. test; This Statement instructs the interpreter to load the test class contained in the package student. InterfaceStatements: An interface is like a class but include a group of method declarations. This is also an optional section and is used only when we wish to implement the multiple inheritance feature in the program.
  • 5. Class Definitions: A Java Program may contain multiple class definitions. Classes are primary and essential elements of a Java Program. Main Method Class: A Main method as its starting point, this class is the essential part of a Java Program. A Simple Java Program may contain only this part. The main method creates objects of various classes and establishes communication between them.