Deepak Bala wrote:Surely anyone naming a class _ should be shot, stabbed and then shot again. I dont think this is from Kathy and Bert's book
Quite probably, but it is a legal class name and thus could appear in the exam. To be honest, lots of the code I see in the books and mocks would result in physical or verbal violence!
Anyway, to the question from the unknown book of darkest mysteries....
Class "_" is called with parameters "-", "A" and "."
Now, the thing to note is the increment section of the "for" loop. It's "++x", so x will never actually be zero in this loop, it will have the values 1 and 2.
Thus the output is "A."
And if you run the code (you did run the code, didn't you, to confirm for yourself?) that is what you get.
So either the code presented here is not what was in the book, or the options given are wrong.