WHAT IS FINAL CLASS IN JAVA?

Royce Roy

Total Post:51

Points:255
Posted by  Royce Roy
Java 
 602  View(s)
Ratings:
Rate this:
  1. Mayank Tripathi

    Post:807

    Points:4035
    What is final class in java?

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


    final class Bike{}  
      
    class Honda1 extends Bike{  
      void run(){System.out.println("running safely with 100kmph");}  
        
      public static void main(String args[]){  
      Honda1 honda= new Honda1();  
      honda.run();  
      }  
    }

    Output:Compile Time Error

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!