• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question from HF second edition

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably that's what they were trying to test. Thanks.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic