Easy learning with example program codes

what is final method in java

A method declared with final keyword is known as final method.


 * This program is used to show that final method can't be override.
 * @author CodesJava
class Show{
	public final void show(){
		System.out.println("Hello world.");
class Display extends Show{
	//error because final method can't be override.
	public void show(){
public class FinalExample2 {
	public static void main(String args[]){
		//creating object of Display class
		Display obj = new Display();
		//method call;


Exception in thread "main" java.lang.VerifyError: 
class overrides final method show.()V
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at Source)
at Source)
at$100(Unknown Source)
at$ Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)

Note: A final method can be inherited but can’t be override.

Java interview questions on final keyword

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki