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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -