Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

need to discuss this loop  RSS feed

 
Alan Hermin
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all..can you give me how this work step by step


The code output 0 ,,,WHY?
[ October 08, 2006: Message edited by: Ala'a Hendi ]
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
j = j++ will not assign j to a value other than 0 because the ++ in this case is a post increment operator. If it were j = ++j then the value of j would increase each time since in this case ++ is a pre increment opearator.
 
wise owen
Ranch Hand
Posts: 2023
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!