Java 实现并扩展一个类

Java 实现并扩展一个类,java,using,extends,implements,Java,Using,Extends,Implements,我想知道为什么在Java中我可以这样做 interface Specification{ double Interest =12.5; void deposit(double); } class Base{ private String Account; public Base(String acct){Account=acct;} public void Show(){System.out.print("Account # "+

我想知道为什么在Java中我可以这样做

    interface Specification{
    double Interest =12.5;
    void deposit(double);
    }

    class Base{
    private String Account;
    public Base(String acct){Account=acct;}
    public void Show(){System.out.print("Account # "+Account);}
    }

    class Child extends Base implements Specification{
    public Child (String acct){super(acct);Show();}
    public void deposit(double cash){System.out.print("Now you have "+cash+" Dollars");}
    }
但我不能这么做

    class Child implements Specification extends Base{
    public Child (String acct){super(acct);Show();}
    public void deposit(double cash){System.out.print("Now you have "+cash+" Dollars");}
    }
在同一类中使用
extends
implements
时,Java或规则中是否有任何特定的顺序。 我想请人给我解释一下原因。

。正常的类声明遵循此语法

NormalClassDeclaration:
    ClassModifiers(opt) class Identifier TypeParameters(opt)
                                               Super(opt) Interfaces(opt) ClassBody
其中
Super

Super:
    extends ClassType
Interfaces:
    implements InterfaceTypeList
接口

Super:
    extends ClassType
Interfaces:
    implements InterfaceTypeList


在我看来,这是有道理的。在定义某事物的功能之前,您需要先定义它是什么。

是的,在java中,扩展类中有特定的顺序第一类,然后您可以实现许多类:

class Child extends Base implements Specification1,Specification2.. -> valid 
&