RSS

Final and Abstract Classes – Back to Basics :-)

23 Nov

image

Final Members: A way for Preventing Overriding of Members in Subclasses

All methods and variables can be overridden by default in subclasses.

This can be prevented by declaring them as final using the keyword “final” as a modifier. For example:

final int marks = 100;

final void display();

This ensures that functionality defined in this method cannot be altered any. Similarly, the value of a final variable cannot be altered.

More Info : http://vinaytechs.blogspot.com/2009/11/final-and-abstract-classes-back-to.html

Advertisements
 
Leave a comment

Posted by on November 23, 2009 in Java Framework

 

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: