Class 31.s08 - Arrays An array is a group of Declaring...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Arrays An array is a group of Declaring arrays 1. Arrays of primitive types int [ ] myGrades = new int [5];                      or              int myGrades [ ]; myGrades = new int [5];                                              myGrades = new int [5]; or more briefly int [ ]   myGrades = new int [5]; 2. Arrays of objects - each value in the array is a Airport [ ]  localAirport = new Airport [4]; Then each Airport must be instantiated individually. e.g. localAirport [0] = new Airport (“BWI”,28);           localAirport [1] = new Airport (“RI”, 18);           localAirport [2] =  e.g. for (int (i = 0; i < 4; i++)                 localAirport[i] = new Airport("", 0); Each element in an array has its own index. The first index is 28f2d7f28548b5bedd4e9fca266c0da891a99900.doc p. 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/08/2008 for the course WRITING 101 taught by Professor Neverland during the Spring '08 term at Loyola Maryland.

Page1 / 3

Class 31.s08 - Arrays An array is a group of Declaring...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online