![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
flamesP
这个作者很懒,什么都没留下…
展开
-
java成员变量的初始化
java变量的初始化一,成员变量的初始化最简单的初始化public class BedAndBreakfast { // initialize to 10 public static int capacity = 10; // initialize to false private boolean full = false;}如果初始化变量时有一些复杂的逻辑,比如首先正常取值,在取值失败时再采用默认值,这时可以考虑将其放到构造函数中:public class原创 2021-06-29 17:34:26 · 944 阅读 · 0 评论 -
理解java类成员变量
Understanding Class Members理解类成员变量@TOCstatic描述符的提出(class variables)When a number of objects are created from the same class blueprint, they each have their own distinct copies of instance variables. In the case of the Bicycle class, the instance variab原创 2021-05-25 22:48:14 · 138 阅读 · 0 评论