/**
 * Example of threads interfering with each other.
 */
class ThreeObjs
{
    public void swap( )
    {
        int tmp = a;
        a = b;
        b = c;
        c = tmp;
    }

    public void print( )
    {
        System.out.println( a + " " + b + " " + c );
    }
    
    private int a = 0;
    private int b = 1111;
    private int c = 88888888;
}

public class NoSync extends Thread
{
    static ThreeObjs obj = new ThreeObjs( );

    public void run( )
    {
        for( int i = 0; ; i++ )
        {
            obj.swap( );
            if( i % 1000000 == 0 )
            {
                obj.print( );
                try { sleep( 1 ); }
                catch( InterruptedException e ) { }
            }
        }
    }

    public static void main( String [ ] args )
    {
        Thread t1 = new NoSync( );
        Thread t2 = new NoSync( );

        t1.start( );
        t2.start( );
    }
}
