• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Different output

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[c]
Thanks Everyone
[/c]
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic