Bookmark Topic Watch Topic
  • New Topic

UNexpected Output  RSS feed

 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Report post to moderator
UNexpected Output
Wats the output to this??
public class Test {
public static void main(String argv[]) {
Test inc = new Test();
int i =0;
inc.fermin(i);
i = i++;
System.out.println(i);
}
void fermin(int i){
i++;
}
}

I m getting 0 but i dont have any clue to this..???
i m using i= i++;
It should increment i to 1..as far as i know....
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Andy. Please look in the SCJP forum where you also posted this.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!