/Java-Patterns

Java Patterns

Primary LanguageJava

Java Design Patterns

Definition: One instance of a class or one value accessible globally in an application.

Use & Benefits

  • Ensure unique instance by defining class final to prevent cloning.
  • May be extensible by the subclass by defining subclass final.
  • Make a method or a variable public or/and static.
  • Access to the instance by the way you provided.
  • Well control the instantiation of a class.
  • Define one value shared by all instances by making it static.
  • Related patterns include