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(); 

}

解决方案 »

  1.   

    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(); 

       } 

    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(); 

    }
    不知楼主到底是什么意思?不过按照上面的代码是可以得出两个直角三角形
      

  2.   

    回复月明清高 请问println print的区别 如你忙的话我就查相关资料 非常感谢你的指证 效果出来了