हिंदी

Define the structure of a JAVA program.

Advertisements

प्रश्न

Define the structure of a JAVA program. 

परिभाषा
Advertisements

उत्तर

  1. Documentation Section: This section contains comments that describe the program, its purpose and other important information.
  2. Package Statement: It is used to declare the package to which the Java class belongs. It helps in organizing related classes.
  3. Import Statement: It is used to include predefined classes and packages required in the program.
  4. Class Declaration: Every Java program contains at least one class. A class is declared using the class keyword and contains variables and methods.
  5. Main Method: The main() method is the starting point of execution in a standalone Java application. It is declared as public static void main(String[] args).
  6. Program Statements: These are instructions written inside methods to perform specific tasks such as calculations, input and output operations.

Input:

import java.util.*;
class Hello
{
    public static void main(String[] args) 
    {
        System.out.println("Hello Java");
    }
}

Output:

Hello Java

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 3: Programming in Java (Review of Class XI Sections B and C) - EXERCISE [पृष्ठ ९८]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
अध्याय 3 Programming in Java (Review of Class XI Sections B and C)
EXERCISE | Q 16. | पृष्ठ ९८
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×