本帖最后由 李琼 于 2012-11-7 19:40 编辑
- interface Playable {
- void play();
- }
- interface Bounceable {
- void play();
- }
- interface Rollable extends Playable, Bounceable {
- Ball ball = new Ball("PingPang");
- }
- class Ball implements Rollable {
- private String name;
- public String getName() {
- return name;
- }
- public Ball(String name) {
- this.name = name;
- }
- public void play() {
- ball = new Ball("Football");
- System.out.println(ball.getName());
- }
- }
复制代码 上述java题有错,本人眼戳,没看出来,求大神 |