Java: Introduction to Arrays - Duke University

Java: Introduction to Arrays

Instructor: Nihshanka Debroy (Notes borrowed from Tammy Bailey)

Arrays

Aggregate data type: stores items/data of same type in a block of consecutive memory locations

Individual locations in array: elements Size of an array: # elements it is able to store Analogies

- Books in a bookshelf - CD rack with slots Simplifies naming

Using Arrays

Arrays have fixed size Subscript or index to access element (start from 0 in Java)

A[10]=20; System.out.println(A[10]); Work well with loops int i; int sum=0; for(i=1;i ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download