class NewThread implements Runnable
{
public void run()
{
System.out.println(Thread.currentThread().getName());
for(int count=1,row=1;row <20;row++,count++)
{
for (int i = 0;i <count;i++)
{
System.out.print("*");
}
System.out.println();
}
}
}
class ThreadTestDemo3
{
public static void main(String args[])
{
NewThread n=new NewThread();
Thread t1=new Thread(n,"thread1");
Thread t2=new Thread(n,"thread2");
t1.start();
try
{
t1.join();
}
catch(InterruptedException e)
{
e.printStackTrace();
}
t2.start();
}
}
{
public void run()
{
System.out.println(Thread.currentThread().getName());
for(int count=1,row=1;row <20;row++,count++)
{
for (int i = 0;i <count;i++)
{
System.out.print("*");
}
System.out.println();
}
}
}
class ThreadTestDemo3
{
public static void main(String args[])
{
NewThread n=new NewThread();
Thread t1=new Thread(n,"thread1");
Thread t2=new Thread(n,"thread2");
t1.start();
try
{
t1.join();
}
catch(InterruptedException e)
{
e.printStackTrace();
}
t2.start();
}
}
{
public void run()
{
System.out.println(Thread.currentThread().getName());
for(int count=1,row=1;row <20;row++,count++)
{
for (int i = 0;i <count;i++)
{
System.out.print("*");
}
System.out.println();
}
}
}
public class ThreadTestDemo3
{
public static void main(String args[])
{
NewThread n=new NewThread();
Thread t1=new Thread(n,"thread1");
Thread t2=new Thread(n,"thread2");
t1.start();
try
{
t1.join();
}
catch(InterruptedException e)
{
e.printStackTrace();
}
t2.start();
}
}
不知楼主到底是什么意思?不过按照上面的代码是可以得出两个直角三角形