Hi there, I have a little confusion with question 15 (page 33) and its answer (page 493) of the
Java 11 OCP study guide (815).
The question asks what is the output of a chunk of code when run as "java Duck Duck Goose". I understand the answer quoted in the book (none of the above), as well as the reasoning (code is missing the static keyword on the main method). However I feel there may be an additional issue at play here: the command being used to run the code.
The java command is being used though the file is specified without the .java extension. I guess my question is this: are we to assume that where "java" is used that the code has already been compiled into bytecode using javac? Or is this a typo within the book and the command should instead be "java Duck.java Duck Goose"?
Another question while I'm at it. On page 10 the main method's parameter, a
String array, is described. I'm curious as to why the example using varargs has a trailing semicolon? Out of curiosity I tried adding the semicolon but as I suspected the compilation failed.
Cheers