Print Short Variable

This program prints the value of a short variable.

Problem Statement

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

Source Code

1 public class PrintShort {
2 public static void main(String[] args) {
3 short age = 25;
4 System.out.println("Age: " + age + " - Eduinq");
5 }
6 }

Program Output

Age: 25 - Eduinq

Explanation

A short variable age is declared and assigned the value 25, then printed with descriptive text, demonstrating short variable declaration and printing.

Quick Links to Explore