final method: final method is inherited but you cannot override it

Java Programming Language / Class, Object and Methods in java

1011

Program:


class Parent{
  final void age(){
	  System.out.println("age 50");
	  }
}
class Child extends Parent{
   public static void main(String args[]){
    new Child().age();
   }
}

/*
Is final method inherited?

 Yes, final method is inherited but you cannot override it. 

*/

Output:

age 50
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.