You are here: Home / Topics / program to explain static import for static Field in Java

program to explain static import for static Field in Java

Filed under: Java on 2023-09-17 15:41:32

// program to explain static import for static Field.

import java.util.Scanner;
import static java.lang.Math.PI;

class StaticImport2
{
public static void main( String args[ ] )
{
 double r, a;
 Scanner sc = new Scanner( System.in );
 
 System.out.print("Enter Radius : ");
 r = sc.nextDouble();
 
 a = PI * r * r;
 
 System.out.println("Area of Circle : " + a);
}
}


Output:

Enter Radius : 10
Area of Circle : 314.1592653589793

About Author:
S
Shyam Dubey     View Profile
If you are good in any field. Just share your knowledge with others.