WHAT IS FINAL CLASS IN JAVA?

Royce Roy

Total Post:0

Points:0
Posted by  Royce Roy
Java 
 729  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

      Modified On Mar-27-2018 11:49:47 PM

Answer

NEWSLETTER

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