出错了,显示:Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method round(double) is undefined for the type MathThe method round(double) is undefined for the type Math
public class Math {
public static void main(String[] args) {
// public static int round(float a) 按照四舍五入返回最接近参数的int
System.out.println("23.45四舍五入的结果为:" + Math.round(23.45));
System.out.println("23.55四舍五入的结果为:" + Math.round(23.55));
}
你的类名 跟 jdk的类名 冲突了, 改个名字就可以了