2016年7月10日

成员变量与初始化块

摘要: public class A { public int number = 5; { number = 10; } public static void main(String[] args) { A a = new A(); System.out.println(a.number); }} 这段代码 阅读全文

posted @ 2016-07-10 23:33 三维迹 阅读(527) 评论(0) 推荐(0)

关于初始化块与构造函数的关系

摘要: public class A{ public static int nextID; public static int ID; public String name ; { ID = nextID; nextID++; } public a(){ this.name = ""; } public a 阅读全文

posted @ 2016-07-10 22:21 三维迹 阅读(274) 评论(0) 推荐(0)

导航