2014-05-22 13:13:48 UTC
Customer and KeyHolders are classes. KeyHolder extends Customer.
1) The line @Override will prevent the code from compiling because assignBike in KeyHolder does not override anything.
2) The line @Override is essential because assignBike in KeyHolder override assignBike in Customer; if it is removed the code will not compile.
3) If the line @Override is removed the code will still compile but assignBike KeyHolder will not override the version inherited from Customer.
4) The line @Override makes the compiled code more compact because it allows compiler to ignore the overridden version of assignBike in Customer.
5) The line @Override is an optional annotation; removing it has no effect on the compiled code.