• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

post fix

 
devarshi pandya
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir,

public class xxx{
public static void main|(String args[]){
int i=10;
i=i++;
System.out.println(i);
O/P is 10 why???
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i = i++ is not what you think it is. See this: JavaRanch FAQ: Post Increment Operator And Assignment.

(Please don't post a question more than once, and choose a forum carefully. This is a beginner's question, not an Advanced Java question).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic