Pages

get our extension

Search program

Monday, 12 August 2013

What is final?

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