0

I was asked in a job interview to give examples of design patterns and how they are used in the JVM implementation? I was stumped -- can anyone suggest answers so I'll know what to say if I'm ever asked again?

Amrendu Pandey
  • 91
  • 1
  • 12

1 Answers1

4
  1. Java File IO library is based on Decorator pattern.
  2. Java Collections sort() uses Strategy pattern.
  3. There is inbuilt support for Observer Pattern in JDK, By using Observable class and Observer interface, you can have Observer Pattern
  4. Singleton Pattern in used in Runtime class, where you can have only one object of type 'Runtime', by accessing getRuntime() method.
Aman Arora
  • 1,232
  • 1
  • 10
  • 26