Java Technologies
Pages
Home
Contact
Blogger Trips and Tricks
Recent Technological Tutorials
Software Interview Puzzles
Algorithms Interview Questions
Java Technologies
Tabs
Home
Java Technologies
Algorithms Interview Questions
Software Interview Puzzles
Recent Technological Tutorials
Blogger Tricks and Tips
contact
Friday, September 2, 2011
i=i++ produces the output "0″ instead of "1″.
The code
int i = 0;
i = i++;
System.out.println(i);
produces the output "0″ instead of "1″.
because:
"i = i++" roughly translates to
int oldValue = i;
i = i + 1;
i = oldValue;
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment