You are here: Home / Topics / Using class with import example in Java

Using class with import example in Java

Filed under: Java on 2023-09-17 15:38:49

//  Using class with import.

import java.util.Scanner;

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


Output:

Enter Radius : 10
Area of Circle : 314.0


About Author:
M
Mr. Dubey     View Profile
Founder of MCQ Buddy. I just like to help others. This portal helps students in getting study material free. Share your stuff here so that others can get benefitted.