Method in Java interface that returns class or subclass type -


i have interface:

public interface displayable {     public class <screen> classtodisplay(); } 

and classes:

public class screen {  }  public class screensubclass extends screen {  }  public class cue implements displayable {      @override displayclass() {         return screensubclass.class;     }  } 

i'm getting ide error telling me incompatible types. return value needed 'classtodisplay()' return class or subclass type of screen?

just figured out. use ? wildcard along 'extends'...

change return type 'displayclass' to:

public class<? extends screen> displayclass(); 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

html - Outlook 2010 Anchor (url/address/link) -