1. an interface represents a kind of behavior and consists of a set of method declarations2. Java documentation:
public String toString()
Returns a string representation of this thread, including the thread's name, priority, and thread group.

解决方案 »

  1.   

    2. Thread.toString() => Thread[name,priority,thread group]
      

  2.   

    main 是他的thread group吗?
    是否
     Thread.currentThread();
            
    的一定是main
      

  3.   

    不见得,那个是main因为它是那个默认的ThreadGroup,你可以把线程加到别的group里去,譬如class twothread implements Runnable
    {
        twothread()
        {
            Thread t1=Thread.currentThread();
            t1.setName("The first main thread");
            System.out.println("The running thread:"+t1); //*********************************
    ThreadGroup tg = new ThreadGroup("another thread group");
            Thread t2=new Thread(tg, this,"these cond thread");
            System.out.println("creat another thread");
            t2.start();
            try
            {
                System.out.println("first thread will sleep");
                Thread.sleep(3000);
            }
            catch(InterruptedException e)
            {
                System.out.println("first thread has wrong");
            }
            System.out.println("first thread exit");
        }
        public void run()
        {
            try
            {
                for(int i=0;i<5;i++)
                {
                    System.out.println("Sleep time for thread2:"+i);
    System.out.println("The running thread:"+Thread.currentThread()); 
                    Thread.sleep(1000);
                }
            }
            catch(InterruptedException e)
            {
                System.out.println("thread has wrong");
            }
            System.out.println("second thread exit");
        }
        public static void main(String args[])
        {
            new twothread();
        }
    }output:
    The running thread:Thread[The first main thread,5,main]
    creat another thread
    first thread will sleep
    Sleep time for thread2:0
    The running thread:Thread[these cond thread,5,another thread group]
    Sleep time for thread2:1
    The running thread:Thread[these cond thread,5,another thread group]
    Sleep time for thread2:2
    The running thread:Thread[these cond thread,5,another thread group]
    first thread exit
    Sleep time for thread2:3
    The running thread:Thread[these cond thread,5,another thread group]
    Sleep time for thread2:4
    The running thread:Thread[these cond thread,5,another thread group]
    second thread exit
      

  4.   

    public interface Transformer
    public Object transform(Object input)
    Transforms the input object (leaving it unchanged) into some output object.
    Returns:
    the transformation of the input object to the output object
      

  5.   

    又是 English?
    又恨又爱……
      

  6.   

    new Thread(tg, this,"these cond thread");this 在这里表示什么意思。
      

  7.   

    this = the current object, in this case, a twothread instance
      

  8.   

    this = the current object, in this case, a twothread instance
      

  9.   

    Thread(ThreadGroup group, Runnable target, String name)this 应该是 target 吧?
    target 是代表什么?