// Java code to declare and print the constant
public class Main {
//integer constant
final static int MAX = 100;
//string constant
final static String DEFAULT = "N/A";
//float constant
final static float PI = 3.14f;
public static void main(String[] args) {
//printing the constant values
System.out.println("value of MAX = " + MAX);
System.out.println("value of DEFAULT = " + DEFAULT);
System.out.println("value of PI = " + PI);
}
}
Output
value of MAX = 100
value of DEFAULT = N/A
value of PI = 3.14
Java code to declare and print the constant
Output