Two Laptop Bag
The moose likes Beginning Java and the fly likes Object class doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Object class doubt" Watch "Object class doubt" New topic

Object class doubt

ashok bantu

Joined: Jan 30, 2009
Posts: 10
Why object class is having these methods and why there are not in Thread class Even though they are final how can we override these methods any valid reason

final void notify(),
final void notifyAll(),
final void wait()
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You can't. They are final thus you can't override them.

They are in the Object class because the designers of Java decided that each object should have a lock.
With those methods you can perform locking and unlocking so that multiple thread can access the object simultaneous.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

also read this
I agree. Here's the link:
subject: Object class doubt
It's not a secret anymore!