Print Byte Variable

This program prints the value of a byte variable.

Problem Statement

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

Source Code

1 public class PrintByte {
2 public static void main(String[] args) {
3 byte level = 10;
4 System.out.println("Level: " + level + " - Eduinq");
5 }
6 }

Program Output

Level: 10 - Eduinq

Explanation

A byte variable level is declared with the value 10 and printed along with descriptive text, demonstrating how smaller integer types can be used for limited ranges of values.

Quick Links to Explore