建立一个名叫Cat的类

    //属性 成员变量
    String name;
    int age;
    String color;
        
    //方法  函数 成员函数
    void name()
    {
        System.out.println("名字为"+name);
    }
    
    void showAge()
    {
        System.out.println("年龄为"+age);
    }
    void jiao()
    {
        System.out.println("喵");
    }
    void yanse()
    {
        System.out.println(color);
    }

 

posted @ 2016-09-18 22:31  张好好  阅读(648)  评论(0编辑  收藏  举报