Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1258 :

Posted: Fri Mar 08, 2013 5:39 pm
by renatumb
I can not understand why dont print
goodgood bye friend!

1st interation: goodgood
2nd: bye
3rd: friend

Doesn't make sense?

Re: About Question enthuware.ocajp.i.v7.2.1258 :

Posted: Fri Mar 08, 2013 7:56 pm
by admin
Why do you think first iteration will print "goodgood"?

Re: About Question enthuware.ocajp.i.v7.2.1258 :

Posted: Wed Oct 16, 2013 1:25 pm
by JavaDev4711
Guess, because he/she thought that : binds more than +, resulting in
i == 0 ? args : " " --> "good" for 0, THEN adding args again --> "good" + "good", while having " " + args for the other i values.

What I missed was that "java Test good bye friend!" was the whole command, not just the arguments. So "none of the above" was obvious to me. Being a killjoy, I could rename the java.exe, so the command would result in "none of the above". Does this make sense?

I guess the test exam questions are just the same style as the real questions, so I don't want to blame Enthuware. To me, many of the questions are obsolete due to IDEs and Google. I want to fly to Mars (solve the question using my knowledge about the conditional and the + operator), but I am forced to discuss the color of the rocket (see that "java Test" is the command at command line and only "good bye friend!" are the arguments).

Re: About Question enthuware.ocajp.i.v7.2.1258 :

Posted: Wed Oct 16, 2013 1:42 pm
by admin
Hello,
It is true that a lot of things are taken care of the IDEs. But this being the first level of certification, you are expected to compile and run the programs from command line using javac and java, without the help of IDEs.
Regarding the confusion about the command line, the question does say the code is run using the command "java Test good bye friend!".

Yes, you could rename java.exe to something else, but that is not really relevant for the exam :) You will need to assume basic things unless specified explicitly in the question. So here, you can safely assume that java is standard java.exe that is used to run a program from the command line.

HTH,
Paul.