CS 121 Chapter Notes - Chapter 8: Array Data Structure, Foreach Loop, Bounds Checking

35 views5 pages

Document Summary

Array: a programming language construct used to organize a list of objects or. It is one of the most fundamental data structures that group data into lists. An ordered list of values (sometimes horizontal or vertical). The array name is like the address of a building, & the index is like the door # of each apartment. To refer to a particular value in an array, use the array name followed by the index in brackets: ex: scores[2] refers to the value 94 (the 3rd value in the array). Each array element can be treated as an individual value. You can print it, make assignment, or use it in a calculation: System. out. println (scores[5]); scores[2] = 89; mean = (scores[0] + scores[1])/2; int first = 0; scores[first] = scores[first] + 2; The values held in an array array elements. The type of these values the element type. One array must save the same type of values.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents