[英]Java (beginner): Cannot find symbol in Math class
家伙。 我已经尝试了一段时间,但似乎无法弄清楚问题是什么。 我已经做过一些研究,但对其他人来说却是大写错字。 我没随便剪 这是完整的代码:
import java.lang.Math;
public class Threesix_RasmusDS
{
public static void smallerAbsVal()
{
int a = 4;
int b = 9;
System.out.println(Math.abs(a, b));
System.out.println(Math.min(a, b));
}
//End of smallerAbsVal
}
//End of class
根据Javadoc, Math#abs
仅接受一个参数,因此它必须是Math.abs(a)
或Math.abs(b)
。 如果您正在寻找最小的绝对值,那将是
System.out.println(Math.min(Math.abs(a), Math.abs(b)));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.