You are here: Home / Topics / How to create Local Constant in Java

How to create Local Constant in Java

Filed under: Java on 2023-08-11 19:14:15

// Program to using final variable within method
// to create local constant.

class  FinalVar1
{
public static void main( String args[ ] )
{
 double r = 10.0, a;
 final double PI = 3.14159;
 a = PI * r * r;
 System.out.println("Area of Circle : " + a);
}
}


Output:

Area of Circle : 314.159

About Author:
V
Vinay Kumar     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.