You are here: Home / Topics / First Program in Java

First Program in Java

Filed under: Java Tutorial on 2024-03-01 20:39:53

This Java program has been developed to display the text 'Hello Planet!' on
the console screen.

// File-Name: Hello.java
public class Hello {
     public static void main(String[] args) {
     // Displaying "Hello Planet!" on the console
     System.out.println("Hello Planet!");
  }
}

Output
Hello Planet!

Key Points to Note:
The Java program above, named Hello, is designed to display the text "Hello Planet!" on the console (output screen).

The execution of a console-based Java program begins with the main method, which serves as the program's entry point.

To output text to the console, the System.out.println() method is used. In this case, it prints the string "Hello Planet!" to the console.

About Author:
J
Java Developer     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.