int i = 1;// i =1
i = i++;// i = 1
int j = i++;//j= 1;i=2
int k = i + ++i * i++;//k =2 + 3 * 3;i=4;
System.out.println("i = " + i);
System.out.println("j = " + j);
System.out.println("k = " + k);
结果
i = 4
j = 1
k = 11
int i = 1;// i =1
i = i++;// i = 1
int j = i++;//j= 1;i=2
int k = i + ++i * i++;//k =2 + 3 * 3;i=4;
System.out.println("i = " + i);
System.out.println("j = " + j);
System.out.println("k = " + k);
结果
i = 4
j = 1
k = 11
本文标题:java自增赋值题
本文链接:https://www.haomeiwen.com/subject/qrkgqctx.html
网友评论