Reputation: 355
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
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 Thread
object and it has a name) and so trackable :
Thread t = new Thread("myThread"){
@Override
public void run() {
...
}
};
Upvotes: 3