guys. I've been trying to figure this out for a while, and I just can't seem to figure out what the problem is. I've done some research, but for others it was stuff like uppercase typos. I didn't cut it with me. Here's the entire code:
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
As per the javadoc, Math#abs
only takes one argument, so it needs to be either Math.abs(a)
or Math.abs(b)
. If youre looking for the smallest absolute value then that would be
System.out.println(Math.min(Math.abs(a), Math.abs(b)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.