A simple Java program that prints a greeting message to the console.
- "Hello, World!"
- "I'm Sanzu"
This program demonstrates the basic structure of a Java application.
javapublic class Hello {
public static void main(String args[]) {
System.out.println("Hello, World!");
System.out.println("I'm Sanzu");
}
}Prerequisites:
- Java Development Kit (JDK) 8 or higher
- A text editor or IDE
Open a terminal or command prompt in the directory containing Hello.java and run.
javac Hello.javaThis will create a Hello.class file containing the bytecode.
Output:
Hello, World!
I'm Sanzu
public class Hello- Defines a public class named Hellopublic static void main(String args[])- The main method, entry point of the programSystem.out.println()- Prints text to the console followed by a new line
Author: Sanzu