2020
09-28
09-28
Java实例域初始化方法及顺序
Java实例域初始化方式1.构造器publicclassEmployee{privateStringname;privateStringgender;privateintage;privatedoublesalary;publicEmployee(){this.salary=1000.0;}publicEmployee(Stringname,Stringgender,intage,doublesalary){this.name=name;this.gender=gender;this.age=age;this.salary=salary;}}2.域声明publicclassEmployee{privateString...
继续阅读 >