Page 1 of 1

An error in enthuware.ocajp.i.v8.2.1312

Posted: Mon Oct 19, 2015 8:39 am
by klhlubek
I found an error in the explanation of the question, which is actually pretty big. ;)
A valid method declaration MUST specify a return type, all other things are optional.
The underlined part is completely false, but as often as I do I see, why you have written that, but it is still not correct, because the identifier of a method is not optional like the parantheses after it or the curly braces, which are again after the parantheses, too.
So correct the mistake, please.

I hope I could help you,

Kamil

Re: An error in enthuware.ocajp.i.v8.2.1312

Posted: Mon Oct 19, 2015 11:01 am
by admin
I sincerely appreciate you taking time in reporting this, but I think you are taking the statements out of context. The statements in explanations are not meant as definitions. A definition has absolutely no extra word and every word is critical. But these are explanations. They are just trying to explain a point in an easy to understand manner. When you explain something, you focus on one point and ignore the rest. That is what an explanation is. Obviously, this will make the statements a bit imprecise. But that is ok. That is the reason people read books instead of specifications, which are supposed to contain 100% precise statements.

So yes, you could argue that "everything is optional" is wrong but I do not agree with that. Here, everything is optional doesn't imply that class is optional, it doesn't mean {} are optional, it doesn't mean () are optional. If you go through all the explanatory statements given with the question, it will be clear that the statement is talking about keywords and parameters. You said it yourself that you see what it implies.

thank you,
Paul.

Re: An error in enthuware.ocajp.i.v8.2.1312

Posted: Mon Oct 19, 2015 11:05 am
by admin
Oh, and by the way, here is the text that explains a valid method declartion in 100% precise fashion:
MethodDeclaration:
{MethodModifier} MethodHeader MethodBody
MethodHeader:
Result MethodDeclarator [Throws]
TypeParameters {Annotation} Result MethodDeclarator [Throws]
MethodDeclarator:
Identifier ( [FormalParameterList] ) [Dims]
Source: https://docs.oracle.com/javase/specs/jl ... ml#jls-8.4