singleton pattern
Class Soup{
private Soup(){}
private static Soup ps1 = new Soup();
public static Soup access(){
return ps1;
}
public void f(){}
}
public class Lunch{
void test(){
Soup.access().f()
}
}
originally posted at medium.com/@xuwenhao/singleton-pattern-6b1217...
| NAV | NEXT ON THE BENCH | DATE | |
|---|---|---|---|
| PREV | 雨过天晴^_^ | 2004 | ← |
| NEXT | 郁闷啊郁闷 | 2004 | → |
THIS BOARD HAS BEEN TESTED.
IT RUNS.
Engineer wouldn't write that last line.
He'd just put the board on your desk and walk away.
So - that's what this is.
He'd just put the board on your desk and walk away.
So - that's what this is.
XUWENHAO.COM ◆ REV 4.7 ◆ MADE IN SHANGHAI ◆ 2026