Panagiotis Kalogeropoulos wrote:I thought your question was about why to use iterators since we have the for loop (scratching my head......). Maybe the expression "pros and cons" that I used was not the best, but in that link you can see why and when you should use the for loop or an iterator. I don't know if that still answers your question (scratching my head again....).
Manoj Kumar Jain wrote:This code will not compile, not because the array is uninitialized. Array elements are initialized with their default value that is 0 for integers.
This will fail because there is a local variable size that is not initialized before using and that is line no. 5
Campbell Ritchie wrote:How old is your book? Have a look through all those classes for valueOf methods, and I think you will find more than there are in your table.
Matthew Brown wrote:You're trying to cast am Integer to a Byte. They aren't compatible, they're on different inheritance branches. That would only make sense if Byte was a subclass of Integer.
Matthew Brown wrote:What makes you think the method doesn't exist? It's there in the documentation.