If you want that behaviour in Java, you have to use ++n instead. n = ++n; will increment n by 1 before the assignment.
n = n++; -> this statement increments n only after the assignment operation is done. On Sat, Jun 5, 2010 at 12:50 PM, Shoubhik <[email protected]> wrote: > Hello, > > in C, > > the following code: > > int n=10; > n=n++; > > assigns 'n' a value of 11 . > > > in Java, > the same code doesnt increment 'n'... it remains 10 !!! > > plzzz explain... > > > Regards, > Shoubhik Bose. > > -- > You received this message because you are subscribed to the Google Groups > "google-codejam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-code%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > > -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
