Java Programming Structure
A java programming structure consists 6 major section:
- Document Section
- Package Statement
- Important Statement
- Interface Statement
- Class Defination and ,
- Main Method Definition inside main class [ESSENTIAL]
1. Document Section π
This section includes to comments to tell tha program's purpose, it improves readability of tha program.
2. Package Statement π
A Package Statement allowed to includes statement that provides a package declaration.
3. Important Statement π§βπ»
In C or C++ if we require to include some external libraries in our program then we use "include" statement, similar java using "import" statement we can use external libraries in our program, it includes statements used for referring classes and interfaces that are declared in other packages.
4. Interface Statement π«
In Java language, an interface can be defined as a contract between objects on how to communicate with eachother, this is similar to class but only includes constants, method declaration, allowed to declare interface.
5 . Class Defination π§βπΌ
It describes information about user defines classes present in the program, this Section allowed to user able to declared other user defined class above ther main method class.
6. Main Method Definition inside class π€
Java Program Execution starts form main method, it Consists main method definition inside class.
π§βπ» Basic java program π§βπ»
class Main{
public static void main (String[] args) {
System.out.println("Hello World");
}
}
π Check out π
β€οΈ Instagram : https://www.instagram.com/_mr.dhaval_io
π₯ Facebook : https://m.facebook.com/dhaval.kurkutiya.3
π¦ Twitter : https://www.twitter.com/dhaval87950061
Top comments (0)