摘要: 一、匿名对象 1.格式: new 对象名(). 属性 = 值; 2.匿名对象方式赋值,只能调用一次,以为每次new时,都会是一个新的对象,每次new都会划分一个新的空间。 例: class student{ int id; String name; } public class studentMan 阅读全文
posted @ 2018-04-18 16:05 猫屎是不是咖啡 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1.class Init{ int num; //成员变量有默认初始化,所以不需要给初始值。 } public class InitDemo{ public static void main(String[] args){ Init s = new Init(); int age = 0; //如果 阅读全文
posted @ 2018-04-18 15:53 猫屎是不是咖啡 阅读(158) 评论(0) 推荐(0) 编辑