Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Different output

 
Ravi Ahuja
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[op]
The output from the following code is
10
10
11
[/op]
[trick]
The Doubt starts here:
When same code is run in c++ it gives the output as
10
11
12 respectively
Any thoughts ?
[/trick]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please search this forum, or our FAQ, for the many previous discussions about this topic. And please forget c++, which is not relevant to this forum.
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravi,

look at this:
http://faq.javaranch.com/view?PostIncrementOperatorAndAssignment

Barry Gaunt posted November 17, 2006 02:47 PM
And please forget c++, which is not relevant to this forum.

Maybe as a variation:


prints CCD


Yours,
Bu.
 
Ravi Ahuja
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

Ravi Ahuja posted November 18, 2006 05:20 AM
code:

i know its irrelevant anyways i thought someone could have helped me anyways forget it


It's not irrelevant, and I found a link for you that should clear the output.
I put the same link here a second time again, perhaps you read it now.

---> http://faq.javaranch.com/view?PostIncrementOperatorAndAssignment


Bu.
 
Ravi Ahuja
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[c]
Thanks Everyone
[/c]
 
Franz Fountain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For this particular forum, I think dialog is important even if it seems like we may be repeating the same conversation. I think dialog is an important part of the learning process. I don't think it's sufficient in this forum to simply say "search the forum for previous answers". I think a lot of learning goes into just forming a question and writing it in your own in your own words.

For example, I suppose if you teach the same class for years you get the same questions over and over. That's ok. That's the reason that someone takes the class so that they can get the opportunity to asks questions on a subject that is new to them. Remember it may be old news to some of you ranch hands and more experienced cowpoke, but it may be new news to the greenhorns. And remember this is a "friendly place for Java greenhorns".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic