Search Results

Search found 1 results on 1 pages for 'gangnus'.

Page 1/1 | 1 

  • Who extends interfaces? And why?

    - by Gangnus
    AFAIK, my class extends parent classes and implements interfaces. But I run across a situation, where I can't use implements SomeInterface. It is the declaration of a generic types. For example: public interface CallsForGrow {...} public class GrowingArrayList <T implements CallsForGrow> // BAD, won't work! extends ArrayList<T> Here using implements is syntactically forbidden. I thought first, that using interface inside < is forbidden at all, but no. It is possible, I only have to use extends instead of implements. As a result, I am "extending" an interface. This another example works: public interface CallsForGrow {...} public class GrowingArrayList <T extends CallsForGrow> // this works! extends ArrayList<T> To me it seems as a syntactical inconsistancy. But maybe I don't understand some finesses of Java 6? Are there other places where I should extend interfaces? Should the interface, that I mean to extend, have some special features?

    Read the article

1