Tuesday, November 07, 2006

An Interesting Java Puzzler
My Tech'Blog' 3.0

Try to figure out the output of the following code...

public class Assignment {
public static void main(String[] a) throws Exception {
int tricky = 0;
for (int i = 0; i < 3; i++)
tricky += tricky++;
System.out.println(tricky);
}
}

No comments: