Results 1 to 17 of 17

Thread: Current thread ! current thread!

Threaded View

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Resolved Current thread ! current thread!

    Code comes up with main as the thread name. Even though the main thread is still running dosen't Thread.currentThread(); see the context in which it is being called?
    Code:
    class T extends Thread{
     public T(String tname){
      super(tname); 
     }
     public void run(){
      Thread t = Thread.currentThread();
      String tname = t.getName();  
      boolean isalive = t.isAlive(); 
      for(int i = 1; i <= 10; ++i){
       System.out.println(tname + " is alive ?" + " : " + isalive); 
      }
     }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width