pattern
1. singleton(单例模式)
variable 设为private, method 设为static,整个code共享一个instance.
2.immutable object
variable设为private,在constructor中即将variable初始化,只有gettor没有settor。
pattern
1. singleton(单例模式)
variable 设为private, method 设为static,整个code共享一个instance.
2.immutable object
variable设为private,在constructor中即将variable初始化,只有gettor没有settor。