Design Pattern Used In JDK

Connect with

Oracle Java
Design pattern is itself a not easy topic in all the language. In java , a lot of question has been asked in all the level specially for mid-management to senior management , there are a lot of question arises while interview process. Few of them is very important e.g. what are the pattern you used in the current project? what are the pattern you know and which one you used and why? for solving what problem you used this? etc… You can find out a lot of pages on the internet , but I tried to recall those gist in one page.

Creational Design Patterns

Singleton : ensure only one instance of a class is created and provide a global access point to that object.

Used in jdk:

  • java.lang.Runtime#getRuntime()
  • java.awt.Desktop#getDesktop()
  • java.lang.System#getSecurityManager()


Creates objects without exposing the instantiation logic to the client and Refers to the newly created object through a common interface.

Used in jdk:

  • java.lang.Class#newInstance()
  • java.lang.Integer#valueOf(String) (also on Boolean, Byte, Character, Short, Long, Float and Double)
  • java.lang.Class#forName()
  • java.lang.reflect.Array#newInstance()
  • java.lang.reflect.Constructor#newInstance()
  • java.lang.Object#toString() (overrideable in all sub-classes)

Connect with

Leave a Comment

Your email address will not be published. Required fields are marked *