JAVA面向对象概述

package 面向对象编程;

import java.text.Bidi;

//鸟类
public class bird {
    //属性 成员变量
    
    //颜色
    String color;
    //重量
    Double weight;
    //行为 方法
    private String Color;
    
    //飞 void-没有返回值
    void fly()
    {
        System.out.println("我能飞");
    }
    //
    void eat()
    {
        System.out.println("我喜欢吃虫子");
    }
    public static void main(String[] args)
    {
        //生成一只鸟的实例 老鹰
        bird eagle=new bird();
        eagle.Color="灰色";
        eagle.weight=(double) 10;
        System.out.println("这是一只鸟 颜色是"+eagle.Color);
        eagle.fly();
        eagle.eat();
    }

}