Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (2.6k points)

I wonder if there is a special reason in Java for using always "extends" rather than "implements" for defining bounds of typeparameters.

Example:

public interface C {}

public class A<B implements C>{} 

is prohibited but

public class A<B extends C>{} 

is correct. What is the reason for that?

1 Answer

0 votes
by (46k points)
There is no denotative variation in the general restraint language between whether a class 'implements' or 'extends'. The constraint circumstances are 'extends' and 'super' - that is, is this class to work with assignable to that different one (extends), or is this class assignable of that one (super).

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...