You are here: Home / Topics / Final Variable Example in Java

Final Variable Example in Java

Filed under: Java on 2023-08-11 19:12:59

//  Program to use final variable to Create constant.

class  FinalVar
{
final static double PI = 3.14159;

public static void main( String args[ ] )
{
 double r = 10.0, a;
 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.