This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Originally posted by Tony Morris: What is the question here? Everyone (almost) knows it won't compile. You'd know that too if you tried. Are you asking why?
Why dont you post some mock questions here for the beta exam?
Krishna Srinivasan
Ranch Hand
Joined: Jul 28, 2003
Posts: 1803
posted
0
What is the question here? Everyone (almost) knows it won't compile. You'd know that too if you tried. Are you asking why?
You can post some mock question and let others to post the answers. As we know there is no mock exams for Java 1.5. This is the way to prepare for tiger exam.
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
posted
0
Actually it prints:
[Java, Added]
which is interesting because it implies that it is first converted to an array and then java.util.Arrays.toString is used to print it.
Originally posted by Barry Gaunt: Actually it prints:
[Java, Added]
which is interesting because it implies that it is first converted to an array and then java.util.Arrays.toString is used to print it.
For %s
If the argument is null, then the result is "null". If the argument implements Formattable, then its formatTo method is invoked. Otherwise, the result is obtained by invoking the argument's toString() method.
So AbstracCollection's toString method is invoked.
Explaination. You are passing list and list1 both reference the same ArrayList, so you can add a String to list1, but you wouldn't be able to add a String to list. But since list is still pointing to the same ArrayList it will have the second added String in the ArrayList and print it.