Skip to main content

Structure of Java Program

Java | Structure: The general structure of Java program, here you will learn to execute statement and fix the common syntax errors.

Step by Steps:
  1. First create the class name as Main.
  2. Add main method (public static void main(String[] args), it is the beginning point of execution.
  3. Use println for print the statements.
  4. Most common syntax errors are missing semicolon and unbalanced brackets.
  5. Comments are created with // for code understanding purpose, comments are not executed.

Here is the Code:

  1. import java.io.*;

  2. class Main {
  3. public static void main (String[] args) {
  4.     //Comments...
  5. System.out.println("Structure of Java.");
  6. }
  7. }

Output: Structure of Java.

Here is the Video: