• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question from HF second edition

 
Tyronne Fernando
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a question from HF second edition page 735.

Which are true about the servlet Wrapper classes? (Choose all that apply.)

A. They provide the only mechanism for wrapping ServletResponse objects.
B. They can be used to decorate classes that implement Filter.
C. They can be used even when the application does NOT support HTTP.
D. The API provides wrappers for ServletRequest, ServletResponse, and FilterChain objects.
E. They implement the Intercepting Filter pattern.
F. When you subclass a wrapper class, you must override at least one of the wrapper class�s methods.

The correct answer given in the book is C.

I thought answer F is correct as well. Is there a use of sub-classing a wrapper class, if we are not overriding at least one of the methods? How can we use a sub-classed wrapper with out overriding any methods?

Like to know everyone else opinion on this. Thanks.
 
Kamal Nassili
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is a difference between what is legal and what's useful/efficient.
So its legal to subclass any concrete class (in this case a wrapper)whithout overriding any of its methods. that does'nt mean it's useful though.

does this make it clear ?
 
Tyronne Fernando
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably that's what they were trying to test. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic