final method: If you make any method as final, you cannot override it.
Java Programming Language / Class, Object and Methods in java
1108Program:
class Parent{ final void age(){ System.out.println("my age is 90"); } } class Child extends Parent{ void age(){ System.out.println("my age is 20"); } public static void main(String args[]){ Child obj= new Child(); obj.age(); } }
Output:
Output:Compile Time Error error: age() in Child cannot override age() in Parent void age(){ ^ overridden method is final 1 error
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.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS