jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes RHE Q10-9 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 "RHE Q10-9" Watch "RHE Q10-9" New topic

RHE Q10-9

Kathy Wang

Joined: Sep 06, 2001
Posts: 28
In RHE book chapter 10, Test Yourself question9:
True or false:
A component subclass that has executed enableEvents() to enable processing of a certain kind of event cannot also use an adapter as a listener for the same kind of event.
Ans: false.
As my opinion,this question is trying to test a component can implements unlimited listeners.But my question is: the component in this question has extended a super component class, how can it extends another class like adapter class? Can anyone kindly give me a reply to explain that? Thanks a lot!
ashok khetan
Ranch Hand

Joined: Jul 29, 2001
Posts: 153
You are taking it a bit wrongly..it simply means that this subclass can register itself with an object of other class that extends the adapter class.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
You can use an anonymous inner class that uses the adapter and listens for the same type of events that the enableEvents is listening for.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Kathy Wang

Joined: Sep 06, 2001
Posts: 28
Thanks ashok and Cindy!
Your explanations do make sense to me now. I took it too limited to a range, and I did not consider all possibilities. Thanks again.
I agree. Here's the link: http://aspose.com/file-tools
subject: RHE Q10-9
It's not a secret anymore!