File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Reg java.lang.Thread creation? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Reg java.lang.Thread creation?" Watch "Reg java.lang.Thread creation?" New topic

Reg java.lang.Thread creation?

V. Potluri
Ranch Hand

Joined: Mar 29, 2007
Posts: 36
Hi All,

In Page# 677 of SCJP5 by Kathy:

It is discouraged to create a Thread using java.lang.Thread class because it is not good OO practise!!!

It makes sense [from OO perspective] to extend java.lang.Thread is when you have a more specialized version of a Thread class.

***I didn't understand above statements. Kindly any one can give more detail info. related to above statements.****

Thanks in advance.

Srinivasan thoyyeti
Ranch Hand

Joined: Feb 15, 2007
Posts: 557

1)People avoid creating Thread "by extending Thread" because
They might need to extend another class.
[they can't extend Thread here]

2)One will extend from thread, to override the current thread functions behavior ( They have their own design issues )

Thanks & Regards, T.Srinivasan
SCWCD 1.4(89%), SCJP 5.0(75%)
ramesh kumar

Joined: Aug 15, 2006
Posts: 25
class Animal

class Cat extends Animal


Cat is one kind of Animal,here Cat inherits all the properties of animal and it can have it's own properties.So if you are extending one class from super class you are deriving one class specific to that super class.

So if you are extending Thread you should be able to create specific kind Thread.That is why it is not good OO design.
I agree. Here's the link:
subject: Reg java.lang.Thread creation?
It's not a secret anymore!