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
Liked By
Write Answer
What is final class in java?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
01-Apr-2015