class ThreadOne extends Thread
{
Test tt = new Test();
public void run()
{
int i = 0;
while(i<3)
{
System.out.println("ThreadOne str = "+tt.str);
i++;
}
}
public ThreadOne(Test tt)
{
this.tt = tt;//tt = tt
}
}
class ThreadTwo extends Thread
{
Test tt = new Test();
public void run()
{
int i = 0;
while(i<3)
{
i++;
System.out.println("ThreadTwo str = "+tt.str);
}
}
public ThreadTwo(Test tt)
{
this.tt = tt;//tt = tt
}
}
class Main
{
public static void main(String[] args)
{
Test tt = new Test();
new ThreadOne(tt).start();
try{Thread.sleep(10);}catch(Exception e){}
new ThreadTwo(tt).start();
}