Named Constant
public class finalconstant
{
public static void main(String[] args)
{
final double PI=3.14; // constant value. can't be change throughout the program.
double radius = 20;
double area = radius * radius * PI;
System.out.println("The area for the circle of radius " + radius + " is " + area);
}
}
{
public static void main(String[] args)
{
final double PI=3.14; // constant value. can't be change throughout the program.
double radius = 20;
double area = radius * radius * PI;
System.out.println("The area for the circle of radius " + radius + " is " + area);
}
}
Output :-