java - Generic Comparable gets a compiler error -


this question has answer here:

i have code:

private class tree<t implements comparable<t>> { } 

i expect put string objects tree, , string implements comparable, looked @ first glance.

but i'm getting error:

> expected private class tree<t implements comparable<?>> {                     ^ 

suggestions?

you need use

private class tree<t extends comparable<t>> { } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -