A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Why String class is final
Joined: Jun 25, 2001
Oct 17, 2002 06:43:00
class is made final. Is there any specific reason why its restricted from allowing other class to subclass it ?
Joined: Jun 06, 2002
Oct 17, 2002 07:59:00
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
Joined: May 17, 2001
Oct 17, 2002 08:50:00
SCJP 1.4<br /><a href="http://www.cise.ufl.edu/~sih" target="_blank" rel="nofollow">www.cise.ufl.edu/~sih</a>
I agree. Here's the link:
subject: Why String class is final
Entity Class Must Not be final ?
Signature of main() method
Global final v/s Local final
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014