java - Abstract class implementing an interface doesnt require method implementation. Why? -
i writing class going implement interface - interface has 1 method defined in it. when write class definition , write implements interfaceservice
after class declaration , end definition , close brackets of class without overriding interface method.. compiles fine. there no compilation error , able save implementing class in eclipse. why so? shouldn't implementing class forced override method? here interface , implementing class definitions:
interface:
public interface interfaceservice{ list<map<string, object>> dosearch(searchvo formvo,string indexname,string type) throws searchexception; long gettotalhitcount(); }
class:
public abstract class clientflagsearch implements searchservice{ }
i have feeling has defining implementing class abstract. why?
shouldn't implementing class forced override method?
no, abstract
class not have implement every method of interface. methods choose not implement remain abstract
, have implemented further down inheritance tree.
if clientflagsearch
not abstract
, indeed have implement every method of searchservice
.
Comments
Post a Comment