- interfacePlayable{
- voidplay();
- }
- interfaceBounceable{
- voidplay();
- }
- interfaceRollableextendsPlayable,Bounceable{
- Ballball=newBall("PingPang");
- }
- classBallimplementsRollable{
- privateStringname;
- publicStringgetName(){
- returnname;
- }
- publicBall(Stringname){
- this.name=name;
- }
- publicvoidplay(){
- ball=newBall("Football");
- System.out.println(ball.getName());
- }
- }
复制代码 这段代码是错误的,但是我不太明白错在哪里?能解释一下吗? |
|