final is a
keyword which is used in two ways:-
è It is used
to declare
constants
final double PI=3.1415; //PI is
constant
è It is use to prevent inheritance
final class School; //subclass to School can not be created.
n
If we declare class as final that means we cannot create sub class of that class
Ex: - final class School
Class Student extends School //invalid
No comments:
Post a Comment