my dog learned polymorphism*
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
Author

Object class doubt

ashok bantu
Greenhorn

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: http://aspose.com/file-tools
 
subject: Object class doubt