jsertx
jsertx

Reputation: 636

Does notifyAll() in java release threads of other classes?

I was wondering if notifyAll() in java release threads of other classes? I mean, with this example:

class Friend extends Thread{}
class Enemiy extends Thread{}

If I do wait() in all threads (Both Friends & Enemies), and then I do:

// Thread Instance of a Friend
friend1.notifyAll()

Will it release also the Enemies instances or only the Friends one?

Upvotes: 1

Views: 196

Answers (1)

gpasch
gpasch

Reputation: 2672

it notifies all the threads that are waitng on that object

Upvotes: 1

Related Questions