static关键字与main方法

static关键字与main方法 静态的成员变量只会在数据共享区中维护一份, 而非静态成员变量的数据会在每个对象中都维护一份的。 class Student{ String name; //使用了static修饰country,那么这时候country就是一个共享的数据。 static String country = "中国"; //国籍 //构造函数 public Stu
相关文章
相关标签/搜索