[Bluej-discuss] documentation for Java arrays

Richard Rasala rasala at ccs.neu.edu
Sun Jun 15 17:40:45 EST 2003


At 11:32 PM 6/15/2003 +0200, you wrote:
>On Sunday, Jun 15, 2003, at 20:07 Europe/Copenhagen, 
>Harrell_Rentz at cathedral.org wrote:
>
>>Where in the API documentation at java.sun.com/docs, does one find the 
>>documentation for Java's built-in arrays created as follows:
>>
>>int[] numbers = { 1, 3, 5 };
>>
>>???
>
>You can't, because it's not there. It is not in the API docs, since arrays 
>are not defined in the class libraries (since they are not normal classes, 
>even though the language designers tried to make them look similar to objects).
>
>You find the description of arrays in the language specification (The Java 
>Language or the reference manual).
>
>Michael


The above code is incorrect.  It should be:

     int[] numbers = new int[] { 1, 3, 5 };

To create an array of size 3 which is initialized with 0's, use:

     int[] numbers = new int[3];


Yours, Richard Rasala






More information about the bluej-discuss mailing list