No, the ? is not a mistake. There isn't a lot about it in the Java Tutorials, but it is half of the conditional operator (also called the ternary operator). It is a bit like having a tiny if-else inside a statement. I found some other links SAMS and Wikipedia.
Go through that program with a pencil and paper and write down what it does. You should be able to work it out easily. Try changing words to args, then you can pass several words in via the command-line arguments.
What boxing/unboxing means is that you can swap Integers and ints around, like this:Not a very useful piece of code, but it shows boxing in action.
Joined: Aug 24, 2008
are ternary operators in scjp 6, tell me the links explain me more clearly about boxing,
Its not only boxing and unboxing, its about put(key, value) method of map too. If the map previously contained a mapping for any key, the old value is replaced. This is happening while putting "aaa" string again to the map.
SCJP 5.0 -- 97%
Joined: Oct 13, 2005
Don't know about the exam, but the ternary operator is a basic operator which any programmer ought to know about.