书上看到一块代码
public class CoolWeatherDB {
....
private static CoolWeatherDB coolWeartherDB; //成员变量
```}
请问,为啥能在类中声明自己?一般什么情况会这样做?这是哪一块的知识点?
书上看到一块代码
public class CoolWeatherDB {
....
private static CoolWeatherDB coolWeartherDB; //成员变量
```}
请问,为啥能在类中声明自己?一般什么情况会这样做?这是哪一块的知识点?
构建单例对象的时候一般这样用,你可以看看对象创建之单例模式