Final and Abstract Classes – Back to Basics :-)

23 Nov


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 :

Leave a comment

Posted by on November 23, 2009 in Java Framework



Leave a Reply

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

You are commenting using your 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: