IntelliJ IDEA2021
public class Math {
public static void main(String[] args) {
int count=0;
double min=-10.8;
double max=5.9;
for(int i=(int)min;i<max;i++){
// int abs=Math.abs(i);
if(abs>6||abs<2.1){
System.out.println(i);
}
}
}
}
//中的abs一直标红
程序安装有问题或者包丢失
消除标红
public class Math 你的类名跟公共类Math冲突了
你把上面注释掉了,当然报红了
因为你的abs被注释掉了,下面的abs进行比较的时候会发现abs并未定义和初始化,导致无法正常进行比较,程序出错。
希望对题主有所帮助!可以的话,帮忙点个采纳!