这段代码有什么错误,搞不明白。复制代码
- 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 = newBall("Football");
- System.out.println(ball.getName());
- }
- }
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |