Unit 3 - 2
Unit 3 - 2
Unit 3 - 2
empid,empname
Class: work_profile
dept,job
Class: salary_details
basic_salary
Final variables and Methods
• All methods and variables can be overridden by
default in subclasses.
• To prevent the subclasses from overriding the
members of the superclass, declare them as final
using final keyword.
final int SIZE=10;
final void showstatus(..) {…}
• Defining method final ensures that functionality of
defined method will not be altered.
• Similarly the value of final variable never be
changed.
Final Classes
• A class that can not be sub-classed is called final class.