根据UML图,写出Java程序的代码

2025-05-14 10:38:49
推荐回答(2个)
回答(1):

public interface ILeanable{
    public void stuy();
}
public interface ITeacher{
    public void teach();
}

public class Person{
    String name;
}

public class Student extends Person implements ILeanable{
    int age;
    String address;
}

public class Teacher extends Person implements ITeacher{
    String major;
    int age;
}

回答(2):

class Person {
public String name;
}
interface ILeanale{
public void study();
}
interface ITeacher{
public void teach();
}
class Student extends Person implements ILeanale {
private int age;

private String address;
@Override
public void study() {
// TODO Auto-generated method stub