Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • 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: 20894
76
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