posted 14 years ago
As Raju pointed out, the statement sName = sName + " Java"; is meant to confuse you. The static variable sName's value doesn't change in name() method. The output possibilities are not just "Sun" and "Sun 0 1 2 3", but also "Sun 0", "Sun 0 1" and "Sun 0 1 2". The reason is simple, the println statement in main method can run anytime while the run method is iterating, thus the value of sName can be anything out of the above 5 possible values when println statement in main method runs...