Hello ^^ I'm Nguyen working for an IT company in Tokyo. It's my first post, so it's a little exciting. ^^ Here are some things to remember when studying Java SE8 Gold. Immediately, I would like to make a note about the singleton class.
** Singleton ** is one of the design patterns that guarantees that no more than one instance of a class is created.
Therefore, singletons are generally implemented according to the guidelines listed below.
Foo.java
public class Foo {
private static final Foo foo = new Foo();
private Foo();
public static Foo getInstance() {
return foo;
}
}
Foo foo = Foo.getInstance();
How about everyone? I hope you understand the singleton class even a little. ^^ See you in the next post! Bye bye!
Recommended Posts