This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

questiion regarding varinble  RSS feed

 
varinder mahajan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class a
{
public static void main(String str[])
{
int a=10;
a=a++;
System.out.println("a:"+a);
}
}

it out puts 10 why?
[ July 30, 2008: Message edited by: varinder mahajan ]
 
Sid Murrey
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it turns out that the Java postfix operator behaves in a weird way.
Check out http://www.rizzoweb.com/java/postfixIncrement.html
This was the fifth result in a google search for "postfix increment operator" by the way ;-)

Cheers,
Sid
[ July 30, 2008: Message edited by: Sid Murrey ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!