← Quiz: Design Patterns: all 10 questions
Quiz: Design Patterns · Question 9 of 10
Java I/O streams such as new BufferedReader(new FileReader(f)) add behaviour by wrapping. Which pattern is this?
Java I/O streams such as new BufferedReader(new FileReader(f)) add behaviour by wrapping. Which pattern is this?
- A.Singleton
- B.Factory
- C.Observer
- D.Decorator
Answer & explanation
Correct answer: Decorator
Each wrapper adds a feature (here buffering) around another object of the same kind.
Can you get the rest right without peeking?
Take the timed Quiz: Design Patterns quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →