Results 1 to 4 of 4
- 01-02-2008, 09:18 AM #1
- 01-02-2008, 05:00 PM #2
Hello, roots.
I think you add the final modifier when you completed a class and you know that there will be no need for it to be the super class of some other class. For example: Let's say Planet is a subclass of Body and Earth is a subclass of Planet, but you do not get different types if Earths as you get different types of planets. Thus, the Earth class must be declared final. I think the purpose of this is to improve performance.
Hope this helps. :)Eyes dwelling into the past are blind to what lies in the future. Step carefully.
- 01-02-2008, 05:09 PM #3
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 696
- Rep Power
- 6
Or if you want to create a class that no one can extends due to the critical functionality in the class. A String class is an example of final class in the Java API.
Website: Learn Java by Examples
- 01-03-2008, 12:54 PM #4
I had a long standing doubt on final classes. May be more people can talk about their views on using final classes for themselves. Thank you tim again "you do not get different types if Earths" this is the kind of view i was talking about. Thank you wsaryada for your response.
dont worry newbie, we got you covered.
Similar Threads
-
UJO Framework 0.72.final
By JavaBean in forum Java SoftwareReplies: 0Last Post: 03-17-2008, 08:28 PM -
which are the final classes in the java APi
By vagarwal_mca in forum New To JavaReplies: 2Last Post: 01-10-2008, 02:47 AM -
problem with final
By sireesha in forum New To JavaReplies: 1Last Post: 11-20-2007, 01:31 AM -
I have a problem with final
By sireesha in forum New To JavaReplies: 1Last Post: 11-20-2007, 12:25 AM -
Poi 3.0-final
By levent in forum Java SoftwareReplies: 0Last Post: 05-22-2007, 07:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks