C Bryant wrote:Yes well, that was sort of the point of the example. The code looks like it should work to me. It makes logical sense syntactically.
Why should there be a two step process? 1. Create the String array. 2. Convert the array to a list? Why can't I do this all in one statement?
You
can do it in one statement:
Perhaps you mean something like this?
If that's your question, then the answer is: Because arrays are part of the Java
language and as such, they get special language-level treatment (kind of like Strings do). The Collections Framework (including ArrayList), is
not part of the language. It's just part of the API. As far as the compiler is concerned, it's no different than any class you or I might write.