本文主要是介绍继承--5.29,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
继承格式:
package javatest2;public class people {int age;double workday;public people(int age, double workday) {this.age = age;this.workday = workday;}
}
package javatest2;public class student extends people {int studyday;public student(int age, double workday, int studyday) {super(age, workday);this.studyday = studyday;}}
package javatest2;public class test {public static void main(String[] args) {student s =new student(5,5,5);System.out.println(s.studyday);}
}
这篇关于继承--5.29的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!