Explain Basic Structure of Java Programing
– Documentation Section
In Java programming, the language documentation part consists of basic information such as author name, creation date, version, program name, company name, and program description. Improves program readability.
No matter what you write in the documentation section, the Java compiler will ignore that statement during program execution. Use comments to write statements in the documentation area. Comments can be single-line comments, multi-line comments, and documentation comments.
– Package Declaration
In the Java programming language package part is always optional. It is placed immediately after the documentation section. This section declares the package name where the class is located. Note that there can be only one package statement in your Java program. Must be defined before all class and interface declarations.
This is important due to the fact Java instructions may be saved in exceptional applications and directories relying on which module they use. For all these classes, the package belongs to one parent directory. Use the package keyword to declare the package name.
– Import Statements
The package part consists only pre-defined classes and interfaces. If you want to use a class from a particular package, you have to import that class. An import statement represents a class stored in another package, and the import keyword is used to import the class. Use the import declaration in ways. Import a specific class or import all classes in a specific package. A Java program can have multiple import statements.
– Interface Section
In this section defines classes you can’t write a Java program without classes. A Java program associate with multiple class definitions. Using the class keyword, a class can be defined A class is a blueprint for a Java program that mainly contains information about user-defined methods, variables, constants etc.. Every Java program has at least one class with a main() method.
– Class Definition
In this section, you can define classes which are an important part of any Java program. It is compulsory that you can’t write a Java program without classes. A Java program can associate multiple class definitions. Using the class keyword, a class can be defined. A class is a blueprint for a Java program.
Mainly it contains information about user-defined methods, variables, constants etc. Every Java program has at least one class with a main() method.
– Class and Variables
In this section you can defines variables and constants that will be used in Java programs, variables and constants are defined immediately after the class definition. Variables and constants are used to store parameter values during program execution. You can also use modifiers to scope and define the lifetime of the variable.
– Main Method
In this section you can defines the main() method in java program also this is essential for all Java programs. Because all Java program execution begins with the main() method always.
– Methods and Behaviour’s
In this section we uses methods to define the functionality of the java program. A method is a simple statement used to execute java programs. These statements are executed only at run time to perform the specified tasks.
TCCI computer coaching institute is located in Bopal Ahmedabad and ISCON Ambli Road in Ahmedabad.
For More Information:
Call us @ +91 9825618292
Visit us @ http://tccicomputercoaching.com