I am using an old compiler (jdk1.1) and I wanna make sure my understanding is correct. I think you can declare a method abstract (although not necessary) in an interface . but some book says "methods in interface should NOT be declared abstract as they are implicitly abstract". so my question is : can you use the abstract modifier for interface method? please help. thanks a lot! chun
You can compile an interface method (in jdk 1.3) with the abstract modifier without error. To quote Mughal: "Interfaces just specify the method prototypes and not the implementation; they are, by their nature, implicitly abstract, i.e. they cannot be instantiated. Thus specifying an interface with the keyword abstract is not appropriate, and should be omitted."
Every method declaration in the body of an interface is implicitly abstract, so its body is always represented by a semicolon, not a block. For compatibility with older versions of the Java platform, it is permitted but discouraged, as a matter of style, to redundantly specify the abstract modifier for methods declared in interfaces.