Java programming structure
Dhavalkurkutiya
Posted on September 25, 2022
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
Posted on September 25, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.