public class Pass {
public static void main(String[] args) {
int x=5;
Pass p=new Pass();
p.doStuff(x);
System.out.print(" main x="+x);<br> }<br> void doStuff(int x){<br> System.out.print("doStuff x="+x++);
}
}
result:
doStuff x=5 main x=5
왜죠?
x++이 왜 안먹히는거죠?
doStuff x=6 main x=5 가 나와야 될거같은데
이유를 모르겠으어요
doStuff x=6 main x=5 이나올라면 어케고쳐야되요?
++x