摘要:
使用this调用成员变量和构造函数public class Person { String name; int age; String address; Person() { System.out.println("Person 无参构造"); } Person(String name, int age) { this.name = ... 阅读全文
摘要:
static成员变量public class Person { String name; static int age; Person() { System.out.println("Person 无参构造"); } void eat() { System.out.println("Person 吃饭"); }}也可以通过类名方式调用... 阅读全文
摘要:
super调用父类构造,必须要写在第一行//Person.javapublic class Person { String name; int age; Person() { System.out.println("Person 无参构造"); } Person(String name, int age) { System.out.prin... 阅读全文