Prev Next
Answers (1)
SANJAY Apr 02, 2021 10:25
Answer:   If we make any class final, we can't inherit it into any of the subclasses.
1. final class Bike{}
2.
3. class Honda1 extends Bike{
4. void run(){System.out.println("running safely with 100kmph");}
5.
6. public static void main(String args[]){
7. Honda1 honda= new Honda1();
8. honda.run();
9. }
10. }

Output:Compile Time Error

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect