Skip to the content.

Java > Hello Java

Hello Java - First Program

The HelloJava program is a simple Java program that demonstrates the fundamental structure of a Java application. It includes key elements such as the package statement, comments, class definition, the main method, and executable statements.


Program Structure

// Package declaration (if any)
package com.vvsk.fullstack;

// Import statements (if needed)

// Class definition
public class HelloJava {
    // Main method - Entry point of the Java program
    public static void main(String[] args) {
        // Print statement to display output
        System.out.println("Hello, Java!");
    }
}

Explanation of Components

1. Package Statement

package com.vvsk.fullstack;

2. Comments Section

// This is a single-line comment
/* This is a multi-line comment */

3. Class Declaration

public class HelloJava {

4. Main Method (PSVM - Public Static Void Main)

public static void main(String[] args) {

5. Actual Code Statements inside main

System.out.println("Hello, Java!");

Output

Hello, Java!

This simple program introduces basic Java syntax and structure, setting the foundation for more advanced programming concepts.