- 博客(3)
- 收藏
- 关注
原创 同一包中,子类的继承性
具体代码如下: class People{ int age,leg=2,hand=2; protected void showPeopleMess(){ System.out.printf("%d岁,%d只脚,%d只手\t",age,leg,hand); } } class Student extends People{ int number; ...
2019-05-25 15:47:14
620
原创 用对象的上转型对象、方法重写,抽象编程:求柱体的体积。
具体代码如下: abstract class Geometry{ //创建抽象类;// public abstract double getArea(); //创建抽象方法,抽象方法必须在抽象类中。// } class Pillar{ Geometry bottom;//抽象类Geometry申明的bottom成员变量。// double height; Pillar(Geometry ...
2019-05-25 14:01:27
711
原创 课后作业,用类来描述计算机中CPU的速度和硬盘的容量。
@ class CPU{ int speed; public int getSpeed(){ return speed; } public void setSpeed(int speed){ this.speed=speed; } } class HardDisk{ int Amount; public int getAmount(){ return amount; } public void s...
2019-05-19 16:39:03
2116
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅