final class: If you make any class as final, you cannot extend it.

Java Programming Language / Class, Object and Methods in java

1004

Program:

 final class Parent{
	int a=30;
	void display(){
		  System.out.println("parent class");
	  }
	}

class Child extends Parent{
  void age(){
	  System.out.println("child class");
	  }

  public static void main(String args[]){
  Child obj= new Child();
  obj.age();
  }
}

Output:

Output:Compile Time Error
error: cannot inherit from final Parent
class Child extends Parent{
                    ^
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.