I am working towards my Sun
Java certification by working through the Java 2 study guide, written by Kathy Sierra and Bert Bates. So far, I have found the book to be an excellent study tool - particularly because of the exam questions it contains. I am having trouble with one of the exam questions though, so I am wondering if anyone can provide assistance. The question I am having difficulty with is in the self-test section at the end of Chapter 2. Please see below:
Qustion 5
How many of the following are legal method declarations?
i) protected abstract void m1();
ii) static final void m1() {}
iii) transient private native void m1() {}
iv) synchronized public final void m1() {}
v) private native void m1();
vi) static final synchronized protected void m1() {}
The answer given in the book is that five of the above method declarations are correct and that only the third is incorrect (because the keyword transient can only be applied to variable declarations).
I think that the fifth method declaration is also incorrect because it is not marked as abstract and yet it ends with a semicolon and not a pair of curly braces. Please could somebody confirm whether my thoughts are correct and offer any supporting explanation that will help me to understand this question better.
Any help much appreciated!