dude i used this program
class sum {

   public static void main(String[] args){
int n;
n=10;
n=n++;
        System.out.println("value of n:"+n);
   }
}
 im printing the value after all the assignments(after the value of n
is incremented) still it gives a value of 10 in output

On Jun 5, 12:27 pm, Rajeev Sampath <[email protected]> wrote:
> 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.

Reply via email to