zxcvc
zxcvc

Reputation: 355

Anonymous Class and Anonymous Thread

What is the difference between anonymous (class and thread) and normal class/ thread? Could we track which thread if its anonymous in multi threading?

Thanks

Upvotes: 1

Views: 740

Answers (1)

davidxxx
davidxxx

Reputation: 131466

An anonymous class of Thread is an anonymous class of the Thread class. That's all.
It has no relation with the fact the thread is visible and identifiable in the scope of the application.

For example, here t is a Thread instance identifiable (it is a Threadobject and it has a name) and so trackable :

Thread t = new Thread("myThread"){
        @Override
        public void run() {
          ...
        }       
};

Upvotes: 3

Related Questions