关于类与对象大一生有问题

问题遇到的现象和发生背景

关于类与对象

用代码块功能插入代码,请勿粘贴截图
运行结果及报错内容 为什么class dog里面没有调用到class Cat的方法,而主类那里调用的就成功输出了,大一小白 不太懂!,有哥教教吗!

public class ClassHomework {
    public static void main(String[] args) {
    Cat a= new Cat();
    String str=a.getold(19);//getold方法return出来后赋值给b
        System.out.println(str);
        a.speak();
    }
}
class Cat {
    int age;
    String kind;
    String name;
    public void speak(){

        System.out.println("汪汪...");
    }
    public String getold(int age){
        String str;
        if(age<=5)
            str="这只狗的年龄是"+age+",这是只年轻的狗";
        else
            str="这只狗的年龄是"+age+",这是只年老的狗";
        return str;
    }
    }
    class dog{
    public static void add() {
        Cat d = new Cat();
        String v=d.getold(1);
        System.out.println(v);

    }
    }