DEV Community

Cover image for Java programming structure
Dhavalkurkutiya
Dhavalkurkutiya

Posted on

Java programming structure

Java Programming Structure

A java programming structure consists 6 major section:

  1. Document Section
  2. Package Statement
  3. Important Statement
  4. Interface Statement
  5. Class Defination and ,
  6. 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");
  }
}
Enter fullscreen mode Exit fullscreen mode

πŸ‘‡ 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)