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.

Java program structure

  • 1.
  • 2.
     A JavaProgram 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 sectioncomprises 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 similarto #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 JavaProgram 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.