• Martin Thoma
  • Home
  • Categories
  • Tags
  • Archives
  • Support me

Recent Posts

Entwurfsmuster-Beispiele

Entwurfsmuster-Beispiele

Singleton Zweck: Stelle sicher, dass es nur eine Instanz dieser Klasse gibt. Beispiel: java.lang.Runtime.getRuntime() public class Singleton { // an instance of a singleton private static Singleton instance = null; // private default constructor to prevent the external creation // of more instances private Singleton() { } // static method which returns the instance public … Read More »
Java Puzzle #9: Template method pattern

Java Puzzle #9: Template method pattern

The following Java Puzzle is an example for the template method pattern. It is a design pattern by the Gang of Four. What is the output of the following snippet: AbstractClass.java: public class AbstractClass { int templateMethod() { return simpleOperation1() * simpleOperation2(); } int simpleOperation1() { return 2; } int simpleOperation2() { return 3; } } ConcreteClass.java … Read More »
  • Martin Thoma - A blog about Code, the Web and Cyberculture
  • E-mail subscription
  • RSS-Feed
  • Privacy/Datenschutzerklärung
  • Impressum
  • Powered by Pelican. Theme: Elegant by Talha Mansoor