提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用静态导入导入类型的多个静态成员
import static java.lang.Math.PI; import static java.lang.Math.sqrt; /** from * N o w J a v a . c o m **/ import static java.lang.System.out; public class Main { public static void main(String[] args) { double radius = 21.9; double area = PI * radius * radius; out.println("Value of PI is: " + PI); out.println("Radius of circle: " + radius); out.println("Area of circle: " + area); out.println("Square root of 2.0: " + sqrt(2.0)); } }