In the exam for first chapter at question 23 the answer is wrong (Answer :C,D ).
It must be only C , javac compiles a .java file into a .class file.
Option D is incorrect. Javadoesn't take name of the class as parameter. The args will be equal with the first String after the name of the class.
Claudiu Stroe wrote:Option D is incorrect. Java doesn't take name of the class as parameter. The args will be equal with the first String after the name of the class.
The study guide is spot-on! Both answers C and D are correct.
Probably the root cause of your thought/assumption is a misunderstanding of parameters and program arguments. You can pass several parameters to the java command. Some of them will be interpreted as options, one will be the class name and some will be passed to the program as arguments. Let's have a look at the java commandSo the first parameter which is not an option, is the name of the class to be called. Other parameters after this will be passed to the class as program arguments.
So options D, E, and F are nothing more than textual descriptions of these possible invocations and you have to select the correct oneAnd obviously option D is the correct one
Claudiu Stroe wrote:I don't know why I complecate simple questions
On the actual exam the number of correct answers you must select is mentioned, so you probably would have selected the correct answers if you knew you had to select 2 answers (because all four other options are more wrong than option D).