• Post Reply Bookmark Topic Watch Topic
  • New Topic

A teaser  RSS feed

 
Ved Antani
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What will be the output of the following code : and WHY ?
---------------------------------------------------------


[ Edited to include code tags - Paul Sturrock ]
[ November 08, 2006: Message edited by: Paul Sturrock ]
 
Martin Simons
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to ask, is this homework?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The output is 0.

Java method arguments are passed by value, and about "i = i++", see the FAQ: Post increment operator and assignment.

Both these issues are being discussed frequently in the Beginner and Intermediate forums here.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question. Moving...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!