摘要: 静态static注意事项 在静态方法中是没有this关键字的 1,静态是随着类的加载而加载,this是随着对象的创建而存在。 2,静态比对象先存在。 静态方法只能访问静态的成员变量和静态的成员方法 静态方法: 成员变量:只能访问静态变量 成员方法:只能访问静态成员方法 非静态方法: 成员变量:可以是 阅读全文
posted @ 2019-05-23 16:11 白河ia 阅读(346) 评论(0) 推荐(0)
摘要: 例子: class student { // 创建一个学生类 private string name; //姓名 private int age; //年龄 public student(){}; //创建一个空参构造 public student (string name, int age) { 阅读全文
posted @ 2019-05-23 00:48 白河ia 阅读(166) 评论(0) 推荐(0)