The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Incremental Operator query

Posted by Muruganandam on November 12, 2000 at 1:23 AM

I am not able to understand why all the printed answers for a is 1 while it is supposed to increase

class test3
{
public static void main(String s[])
{
int a = 1;
System.out.println(a);
a=a++;
System.out.println(a);

a=a++;
a=a++;
System.out.println(a);

a=++a;
System.out.println(a);
a=++a;
a=++a;
System.out.println(a);

}
}




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us