Skip to content

heysanzu/Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

First Java Program

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.java

This will create a Hello.class file containing the bytecode.

Output:

Hello, World!
I'm Sanzu
  • public class Hello - Defines a public class named Hello
  • public static void main(String args[]) - The main method, entry point of the program
  • System.out.println() - Prints text to the console followed by a new line

Author: Sanzu

About

Java programming with examples.

Topics

Resources

Stars

Watchers

Forks

Languages