集册 Java实例教程 从父级调用构造函数

从父级调用构造函数

欢马劈雪     最近更新时间:2020-01-02 10:19:05

690
从父级调用构造函数

class Ball

{

      private double weight;
/*n o w j a v a . c o m - 时  代  Java*/

      public Ball(double weight)

      {

            this.weight = weight;

      }

}


class BaseBall extends Ball

{

      public BaseBall()

      {

            super(5.125);

      }

}