Easy learning with example program codes

what is final class in java?

final class in java

A class declared with final keyword is known as final class. A final class can’t be inherited.


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


Exception in thread "main" java.lang.Error: 
Unresolved compilation problem:
The type Display cannot subclass the final class Show

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