Java Program to Display Welcome Messages – Simple Output Example

If you’re just getting started with Java, one of the first tasks you’ll encounter is printing output on the screen. This is done using the System.out.println() method. In this post, we’ll write a Java program to display welcome messages such as:

  • Welcome to Java
  • Learning Java Now
  • Programming is fun

This example is ideal for absolute beginners learning basic Java syntax and console output.


Understanding the Program

Before we look at the code, let’s break down what this Java program does:

  • It uses the main() method, which is the entry point of any Java program.
  • The System.out.println() method is used to print text followed by a newline.

Java Program to Display Welcome Messages

public class WelcomeMessages {
public static void main(String[] args) {
System.out.println("Welcome to Java");
System.out.println("Learning Java Now");
System.out.println("Programming is fun");
}
}

Output:

Welcome to Java  
Learning Java Now
Programming is fun

Explanation of the Java Program

  • Class Declaration: public class WelcomeMessages defines the class name.
  • Main Method: public static void main(String[] args) is the starting point of Java execution.
  • Print Statements: Each System.out.println() prints one line of text to the console.

Why Learn This?

This simple Java program to display welcome messages is a great introduction to:

  • Java syntax and structure
  • Console output using System.out.println
  • How Java programs are compiled and executed
Previous Article

SQL Experiments List, Top 12 Practical Tasks for Students

Next Article

Cramer’s Rule in C – Program to Solve Linear Equations

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨