public class HelloWorld {
public static void main(String[] args) {
int m = 5;
int n = 7;
int x=(m*8/(n+2))%m;
System.out.println("m:" + m);
System.out.println("n:" + n);
System.out.println("x:" + x);
}
}
4%5=0余4
int类型会有自动类型转换所以40/9的结果是4,4和5取余的结果是4
先算括号里的,n+2=9, 再算m*8=40, 然后算(m*8/(n+2))=40/9=4 ,最后4%m=4/5=4