Java程序测试之线程的使用

package thread_test;

class A implements Runnable
{
    public void run()
    {
        while(true)
        {
            System.out.println("AA");
            
        }
    }
}

class B implements Runnable
{
    public void run()
    {
        while (true)
        {
            System.out.println("BB");
            try
            {
                Thread.sleep(500);
            }
            catch(Exception e)
            {}
        }
    }
}


public class Thread_test 
{
    public static void main(String[] args)
    {
        Thread aa = new Thread(new A());
        Thread bb = new Thread(new B());
        //aa.start();
        bb.start();
    }

}

 

posted @ 2015-03-17 22:25  JonLi  阅读(153)  评论(0编辑  收藏  举报