我编了程序
public class Test
{
public static void main(String[] args)
int x=2;
x/=x+1;
System.out.println("x="+x);
}
结果为0
请问是怎么运算出来的
...全文
1165打赏收藏
初学者提问 求大神解惑
假设整型变量x的当前值为2,则复合赋值语句x/=x+1执行后x值为多少? 我编了程序 public class Test { public static void main(String[] args) int x=2; x/=x+1; System.out.println("x="+x); } 结果为0 请问是怎么运算出来的