File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes can we put synchronized keyword infront of  run method of Runnable interface ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "can we put synchronized keyword infront of  run method of Runnable interface ?" Watch "can we put synchronized keyword infront of  run method of Runnable interface ?" New topic
Author

can we put synchronized keyword infront of run method of Runnable interface ?

vitthal wable
Greenhorn

Joined: Sep 09, 2006
Posts: 16
can we make run metohd synchronized if so then what about overriding the run from Runnable interface?pls reply Soon
Ådne Brunborg
Ranch Hand

Joined: Aug 05, 2005
Posts: 208
What happens if you try? And what are you trying to achieve?
[ November 14, 2006: Message edited by: �dne Brunborg ]

Entia non sunt multiplicanda praeter necessitatem
Harshil Mehta
Ranch Hand

Joined: Mar 17, 2005
Posts: 64
if so then what about overriding the run from Runnable interface?


if you put synchronized keyword in any superclass/interface method, it is still a legal overriding.
vitthal wable
Greenhorn

Joined: Sep 09, 2006
Posts: 16
i want to know that if i am making it synchronized then i am changing the signature of run() method from class which is implementing it means i am breaking the overriding rule...
Rambabu Gonela
Greenhorn

Joined: Jul 31, 2006
Posts: 24
When a subclass method matches in name and in the number and type of arguments to the method in the super-class (that is, the method signatures match), the subclass is said to override that method.

Here synchronized is not part of method signature, so you are not breaking overriding rule ..
ok
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can we put synchronized keyword infront of run method of Runnable interface ?