You are here: Home / Topics / Program to explain static import statement in Java

Program to explain static import statement in Java

Filed under: Java on 2023-09-17 15:40:54

//  program to explain static import statement.

import static java.lang.Math.*;
//   import static java.lang.Math.sqrt;

class StaticImport
{
public static void main( String args[ ] )
{
 double a = 3.0, b = 4.0;
 double c = sqrt( a*a + b*b );
 System.out.println(" C = " + c );
}
}

 

Output:

C  =  5.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.