File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes <T extends String> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "<T extends String>" Watch "<T extends String>" New topic

<T extends String>

Heba Mahmoud
Ranch Hand

Joined: Apr 26, 2009
Posts: 62

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

SCJP Pass 85%....
Thousands of candles can be lighted from a single candle, and the life of the candle will not be shortened
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

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.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Henry Wong

Joined: Sep 28, 2004
Posts: 20535

Also, T can also be String -- and so since String is a final class, it can only be String.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
I agree. Here's the link:
subject: <T extends String>
It's not a secret anymore!