COMP 250 Lecture Notes - Lecture 4: Pseudocode, Dynamic Array

29 views5 pages

Document Summary

As you know from comp 202 (or equivalent), an array is a data structure that holds a set of elements that are of the same type. Each element in the array can be accessed or indexed by a unique number which is its position in the array. An array has a capacity or length, which is the maximum number of elements can be stored in the array. In java, we can have arrays of primitive types or reference type. For example, int[] myints = new int[15]; creates an array of type int which has 15 slots. We can also de ne an array of objects of some class, say shape. This array can reference up to 428 shape objects. At the time we construct the array, there will be no shape objects, and each slot of the array will hold a reference value of null which simply means there is nothing at that slot.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions