final
keyword can be used with method and class, but if we used it with method then method can't be override and if we used it with class then it can not be extend means? For that please let me know what is main difference between override and extend?
For example below program give compilation error(Compile time error):
Class Bike{
final void run(){
System.out.println("running");
}
}
class Honda extends Bike{
void run(){
System.out.println("running safely with 100kmph");
}
public static void main(String args[]){
Honda honda= new Honda();
honda.run();
}
}