Results 1 to 4 of 4
- 01-02-2008, 10:18 AM #1
- 01-02-2008, 06:00 PM #2
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, 06:09 PM #3Senior Member
- Join Date
- Jun 2007
- Bali, Indonesia
- Rep Power
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, 01: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.
- By JavaBean in forum Java SoftwareReplies: 0Last Post: 03-17-2008, 09:28 PM
- By vagarwal_mca in forum New To JavaReplies: 2Last Post: 01-10-2008, 03:47 AM
- By sireesha in forum New To JavaReplies: 1Last Post: 11-20-2007, 02:31 AM
- By sireesha in forum New To JavaReplies: 1Last Post: 11-20-2007, 01:25 AM
- By levent in forum Java SoftwareReplies: 0Last Post: 05-22-2007, 07:05 AM