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
byte level = 10; Declares a byte variable named level with value 10. System.out.println("Level: " + level + " - Eduinq"); Prints the value of the byte variable along with Eduinq branding. Closing braces } End of method and class. Conclusion: This program demonstrates how to declare and print a byte variable. It shows how smaller integer types can be used for limited ranges of values.