This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Why String class is final Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why String class is final" Watch "Why String class is final" New topic

Why String class is final

Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
Why the String class is made final. Is there any specific reason why its restricted from allowing other class to subclass it ?
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
One reason may be that String is immutable, and it isn't a good idea to have mutable subclasses of String being passed around, used as hash keys, etc.

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Sayed Ibrahim Hashimi
Ranch Hand

Joined: May 17, 2001
Posts: 148
Go to:

SCJP 1.4<br /><a href="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Why String class is final
It's not a secret anymore!