java - Implementing class embedded in an interface -
assume have interface class embedded in (the purpose being interface must provide 'type'. interface has methods using 'type'. so, in file s.java, have
public interface s { public class stype { } public abstract void f( stype ); }
i want implement interface, , try this, in file ss.java:
public final class ss implements s { public class stype extends java.util.hashset<integer> { } public void f( stype ) { // ... } }
however, when try compile these files ("javac s.java ss.java"), usual error message "ss not abstract , not override abstract method f(stype) in s" indicating "f()" in concrete class not proper implementation of "f()" in interface. why?
try with:
public final class ss implements s{ public class stype extends java.util.hashset<integer> { } public void f(s.stype a) { // .. } }
edit:
perhaps, need this:
public interface s<stype> { public void f( stype ); } public final class ss implements s<hashset<integer>> { public void f(hashset<integer> ){ // ... } }
Comments
Post a Comment