John Consorti wrote:I believe the second code block on page 274 should read "public abstract interface CanSwim".
No, it should not! The abstract modifier in an interface declaration is allowed but discouraged. So you might encounter the following interface declaration on the examAnd you should know it's valid code (which will compile successfully), but the compiler will not translateintoSo the code snippet in the study guide on page 274 is accurate as-is.
Hope it helps!
PS. If you download a Java decompiler (like JAD), you can create an interface, compile it, decompile the .class file and verify it yourself
In this example, the abstract keyword is first automatically added to the interface definition."
I apologize if I am misunderstanding, but I want to be sure I'm understanding exactly what is going on.
Keep in mind the book is teaching you for the exam. Whether the compiler gets rid of the word "abstract" in the interface isn't important for the exam. The methods are logically abstract and you can't instantiate the interface. That's the important part here.
While it is fine to use a decompiler, don't let it distract you from the level of understanding required for the exam. You don't want to get a question wrong based on a decompiler output. Also keep in mind compilers (and decompilers) may optimize the code. If you don't know Java well, I wouldn't recommend using the decompiler. I think it could confuse you.
After you've passed the exam, though, using a decompiler can provide some interesting insights into how the compiler works. Just remember that the exam isn't asking questions about how the compiler works.
Ganesh Patekar wrote:use jad command to decompile that .class file like shown in screenshot image.
I wonder why you have posted this as a screenshot and not simply as a plain code snippet (and UseCodeTags of course )? If I want to compile (and execute) your code snippets, I know have to type them myself. And yes, I am (very) lazy So I'll be losing precious time which I could otherwise be spending on typing a nice reply... And another reason: attached images are not searchable using the search engine, some text or a code snippet definitely is.
Roel De Nijs wrote:PS. If you download a Java decompiler (like JAD), you can create an interface, compile it, decompile the .class file and verify it yourself
Since I was the first in this thread to mention the use of a Java decompiler, I like to emphasize it should only be used just for fun and by no means to prepare yourself for the certification exam. Because as already mentioned by Jeanne and Paul: