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

Using class without import in Java

Filed under: Java on 2023-09-17 15:39:27

//  Using class without import.

class  ImportTest
{
public static void main( String args[ ] )
{
 double  r, a;
 java.util.Scanner sc = new java.util.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:
S
Shyam Dubey     View Profile
If you are good in any field. Just share your knowledge with others.