Arrays in Java - Arrays in Java Introduction Java, like...

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

View Full Document Right Arrow Icon
Arrays in Java Introduction Java, like most programming languages has arrays —lists of elements of a certain type, where the size of a list is fixed when the array is first created. In Java, arrays are objects. We provide a very brief summary of one- and two-dimensional arrays. Turn to Chapter 8, pp. 271–297, of Gries/Gries for complete discussion of one-dimensional arrays. Read Chapter 9, pp. 301–311 to see how a two-dimensional array is handled as an array of arrays. Declaration of one-dimensional array variables Use int[] b; JFrame[] j; to declare a variable b that can contain an object that is an array of ints and a variable j that can contain an object that is an array of JFrames. Arrays are objects, and variables b and j can contain the names of array objects. Initially, b and j contain null . Note that int [] and JFrame[] are types. We read these as type "int array" and type "JFrame array". Creation of an array
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 07/07/2008 for the course CS 101 taught by Professor Gries during the Spring '08 term at Cornell University (Engineering School).

Page1 / 2

Arrays in Java - Arrays in Java Introduction Java, like...

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