0
0
Javaprogramming~15 mins

Writing first Java program - Mini Project: Build & Apply

Choose your learning style9 modes available
Writing first Java program
📖 Scenario: You want to create a simple Java program that prints a greeting message to the screen. This is like writing a short note to say hello to anyone who runs your program.
🎯 Goal: Build a Java program that prints Hello, Java World! to the console.
📋 What You'll Learn
Create a public class named HelloWorld
Add a main method inside the class
Use System.out.println to print the greeting message
Print exactly Hello, Java World!
💡 Why This Matters
🌍 Real World
Printing messages is the first step in learning Java. It helps you understand how programs start and show information.
💼 Career
Every Java developer writes programs that start with a main method and print output. This is the foundation for all Java applications.
Progress0 / 4 steps
1
Create the public class
Write a public class named HelloWorld with an empty body using curly braces { }.
Java
Need a hint?

In Java, every program needs a class. Start by writing public class HelloWorld { }.

2
Add the main method
Inside the HelloWorld class, add the public static void main(String[] args) method with empty curly braces { }.
Java
Need a hint?

The main method is where the program starts. Write public static void main(String[] args) { } inside the class.

3
Print the greeting message
Inside the main method, write System.out.println("Hello, Java World!"); to print the greeting message.
Java
Need a hint?

Use System.out.println to show text on the screen. Put the exact message inside the quotes.

4
Run and display the output
Run the program and print the output. Use System.out.println already added to show the message. Just run the program to see Hello, Java World! printed.
Java
Need a hint?

Run your program in your Java environment or IDE. The console should show Hello, Java World!.