Java program for static methods and static variables

 class Circle 

{

 static float PI = 3.1415f;

 static float area(float radius)

 {

  return PI*radius*radius;

 } 

 public static void main(String ar[])

 {

  int r = 4;

  float area = Circle.area(r);

  System.out.println("Area : "+area); 

 }

}


OUTPUT





Comments