aspose file tools*
The moose likes Beginning Java and the fly likes About Final keyword Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "About Final keyword" Watch "About Final keyword" New topic
Author

About Final keyword

Ja King
Greenhorn

Joined: May 15, 2009
Posts: 28
I want to know the details about the final keyword...

What is the use of preventing a method from overriding by using final keyword...
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3775

vijai ganesh wrote:I want to know the details about the final keyword...
What is the use of preventing a method from overriding by using final keyword...


If the method should not be overriden in sub classes (i.e: that the implementation is complete/suficient so subclasses can be satisfied with this one). In that way other parts of the application can make sure the behavior of the method in any class (when used).


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Tekchand Prasad
Ranch Hand

Joined: Oct 20, 2005
Posts: 32
The final keyword may be applied to a class, indicating the class may not be extended (subclassed).
The final keyword may be applied to a method, indicating the method may not be overridden in any subclass.
Examples

A class may never be both abstract and final. abstract means the class must be extended, while final
means it cannot be.

A method may never be both abstract and final. abstract means the method must be overridden, while
final means it cannot be.
Sumit Patil
Ranch Hand

Joined: May 25, 2009
Posts: 296

Please go thru this

http://javapapers.com/core-java/explain-the-final-keyword-in-java/



Thanks & Regards, Sumeet
SCJP 1.4, SCWCD 5, LinkedIn Profile
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Final keyword
 
Similar Threads
Mughal's Mock Exam-Main method declaration
Final Methods !!
How does this work
Mughal's Mock Exam-Main method declaration
Problems in Inheritence