Home > DeveloperSection > Interviews > What is final class in java?

Posted on    April-01-2015 12:35 AM

 Java Java 
 1 Answer(s)
  563  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Posted on    April-01-2015 1:13 AM

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();  

Output:Compile Time Error

Don't want to miss updates? Please click the below button!

Follow MindStick