package com.bjsxt.inherit;
public class Person {
String name;
int height;
public void rest(){
System.out.println("休息!");
}
public static void main(String[] args) {
Student s = new Student("zhang",180,90);
System.out.println(s instanceof Person);
}
}
class Student extends Person{
int score;
public void study(){
System.out.println("学习!"+this.name);
}
Student(String name,int height,int score){
this.name = name;
this.height = height;
this.score = score;
}
}
日常练习之继承
最新推荐文章于 2024-09-08 12:41:07 发布