W
whl
Dear all
I am a freshman ,I from china, I have been learn java for
mouths,my English isn't very well ,may my question expression is not
very clear,but I hope I can learn with you together! thank you !
.. when I do some test ,I found the question ,It is the code
======start=========
public class Inc{
public static void main(String argv[]){
Inc inc = new Inc();
int i =0;
inc.fermin(i);
i = i++;
System.out.println(i);
}
void fermin(int i){
i++;
}
}
========end========
I think the result is 1,but the real result is 0. I don't kown the
statement i=i++ operation sequence. In my opinion , variable i's
values is 0,then i++ ,the variable i's values is 1. They share a
common memory space,the variable i should change the values.
I need your help!
I am a freshman ,I from china, I have been learn java for
mouths,my English isn't very well ,may my question expression is not
very clear,but I hope I can learn with you together! thank you !
.. when I do some test ,I found the question ,It is the code
======start=========
public class Inc{
public static void main(String argv[]){
Inc inc = new Inc();
int i =0;
inc.fermin(i);
i = i++;
System.out.println(i);
}
void fermin(int i){
i++;
}
}
========end========
I think the result is 1,but the real result is 0. I don't kown the
statement i=i++ operation sequence. In my opinion , variable i's
values is 0,then i++ ,the variable i's values is 1. They share a
common memory space,the variable i should change the values.
I need your help!