Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Programmer Certification (OCPJP)
Post-increment operator
Aakash Chandel
Greenhorn
Posts: 27
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
package inc; public class IncrementDemo { public static void main(String[] args) { IncrementDemo demo = new IncrementDemo(); int i = 0; i = i++; System.out.println(i); //prints 0 int a = i++; System.out.println(i); //prints 1 System.out.println(a); //prints 0 } }
The output of the above code is : 0 1 0 which flattened my understanding about post-increment operators.
Why the output of the above program is not 1 2 1 ?
Can anybody give some insight on this ?
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
I like...
posted 13 years ago
3
Number of slices to send:
Optional 'thank-you' note:
Send
We do have an FAQ entry . look
here
.
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
post increment
A simple question i=i++ ?!
Increment Operator
post increment
Why its not incrementing???
More...