Print Integer Variable

This program prints the value of an integer variable to the console.

Problem Statement

Write a Java program that declares an integer variable and prints its value.

Source Code

1 public class PrintInteger {
2 public static void main(String[] args) {
3 int num = 25;
4 System.out.println("The integer value is: " + num + " - Eduinq");
5 }
6 }

Program Output

The integer value is: 25 - Eduinq

Explanation

An integer variable num is declared and assigned the value 25. It is then concatenated with descriptive text and printed, demonstrating how to declare and display an integer variable.

Quick Links to Explore