This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I am reading K&B book, page :15, and tried following combinations and getting compilation error, Can any one explain me what could be logic for it.
1) private & protected with "final" modifier 2) private & protected with "strictfp" modifier 3) private & protected with "abstract" modifier , i can understand the combination of private & abstract showing compilation error.
final modifier means that you can't change the value of a variable member , and with methods it means that you can't override it so all access modifiers(private , protected, public ..) can be used with final.
abstract modifier means that the method is not implemented. You can declare an abstract method in an abstract class or an interface. In an abstract class, you can only apply protected, public or "Default" access modifers: you CAN'T apply private modifier because the first non-abstract method that extends the abstract class doesn't inherits private methods.
In an interface, all methods declared are by default public and abstract, so you can only use public with abstract.
Finally, a method can't be final and abstract at the same time final -> can't override the method abstract -> you must override the method
SCJP 5, SCWCD 5
subject: combination of access & non-access modifiers for a class