Print Final Integer Constant

This program prints the value of a final integer constant.

Problem Statement

Write a Java program that declares a final integer constant and prints its value.

Source Code

1 public class FinalInteger {
2 public static void main(String[] args) {
3 final int MAX_USERS = 100;
4 System.out.println("Maximum users allowed: " + MAX_USERS + " - Eduinq");
5 }
6 }

Program Output

Maximum users allowed: 100 - Eduinq

Explanation

A constant integer MAX_USERS is declared using the final keyword and printed with descriptive text, showing how to declare and print integer constants using final.

Quick Links to Explore