S.D. MADHAN
Not many get the right opportunity !
S.D. MADHAN
Not many get the right opportunity !
Adam Burda wrote:
DotComTestDrive.java:18: setLocationCells<java.util.ArrayList<java.lang.String>>
in DotCom cannot be applied to <int[]>
theDotCom.setLocationCells<locations>;
^
1 error
S.D. MADHAN
Not many get the right opportunity !
Adam Burda wrote:Please forgive me, Im still not understanding.
4. ArrayLists in Java 5.0 are parameterized.
We just said that unlike arrays, ArrayLists have no special syntax. But they do use something special that was added in Java 5.0 Tiger -- parameterized types.
The <String> in angle brackets is a "type parameter". ArrayList<String> means simply "a list of Strings", as opposed to ArrayList<Dog> which means, "a list of Dogs".
In the 2nd comment where says: "Change the String array to an ArrayList that holds
Strings" should say: "Change the int array to an ArrayList that holds Strings"
(You are changing from a int[] to a ArrayList<String>.)
Adam Burda wrote:Ok first let me say thank you to all of you that have tryed to help me. I have read your posts, I have tryed to change the code im working on with no success.
Can some body please show me the correct lines in the code that i need to change and to what they need to be. Out of all the noob's im the bigest. Or maybe just
a real dumb noob!
And again I do thank you for all your help.
Walter Gabrielsen Iii wrote:Okay, I think you are having trouble with type safety. Jump to page 540 of Head First Java and read that page.
The page 137 starts the hint though.
4. ArrayLists in Java 5.0 are parameterized.
We just said that unlike arrays, ArrayLists have no special syntax. But they do use something special that was added in Java 5.0 Tiger -- parameterized types.
The <String> in angle brackets is a "type parameter". ArrayList<String> means simply "a list of Strings", as opposed to ArrayList<Dog> which means, "a list of Dogs".
Also, Page 139 from the Errata for Head First Java:
In the 2nd comment where says: "Change the String array to an ArrayList that holds
Strings" should say: "Change the int array to an ArrayList that holds Strings"
(You are changing from a int[] to a ArrayList<String>.)
Head First Java doesn't give you the complete code for remaking the application with ArrayList<String>. My guess is that this section was chopped into the book after Java 5 came out, and they were just giving you an example of how type safety works but not expecting you to think too much about it, or compile it, until later chapters.