public class Puls{
public static void main (String[] args) {
int a = 10;
int b = a ++; \\ 先赋值再自加
int c = ++ a; \\先自加再赋值
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
得出a=12,b=10,c=12
public class Puls{
public static void main (String[] args) {
int a = 10;
int b = a ++; \\ 先赋值再自加
int c = ++ a; \\先自加再赋值
System.out.println(a);
System.out.println(b);
System.out.println(c);
}
}
得出a=12,b=10,c=12
本文标题:++ i 与 i ++
本文链接:https://www.haomeiwen.com/subject/iqztyttx.html
网友评论