• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<T extends String>

 
Heba Mahmoud
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


how this don't cause complair error although the String class is final and can't be exteneded.
as what happens when when say

 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not extending string there. The construct simply means the generic type can be anything that extends String. Of course String is final and nothing can extend it.
 
Henry Wong
author
Marshal
Pie
Posts: 21190
80
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, T can also be String -- and so since String is a final class, it can only be String.

Henry
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic