Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSIS 110 - Lecture 15: Arrays and ArrayLists - Prof. Brian F. Hanks, Study notes of Javascript programming

Information on csis 110 lecture 15, covering topics such as arrays and arraylists, including how to declare them, keep track of size, add elements, access elements, print values, and search for specific values. Students are reminded of upcoming quizzes and homework assignments.

Typology: Study notes

Pre 2010

Uploaded on 08/05/2009

koofers-user-tf7
koofers-user-tf7 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSIS 110 - Lecture 15
Announcements
Quiz – next Wedsnesday
Turn in Homework
Let's look at some code for arrays and ArrayLists.
First, let's declare an array and an ArrayList of String:
private String[] theArray = new String[50];
private ArrayList<String> = new ArrayList<String>();
Now, what do we need to do to keep track of the size (the number of elements that
contain data)?
- ArrayList does it automatically for us
- We need to use another variable to keep track of elements being used in the array:
private int count = 0;
Now, how do we put an element in the next position in the array or the ArrayList? [Don't
forget about count].
How do we access an element at position i? [What happens if i < 0 or i >= count?]
How do we print all of the values in the array or the ArrayList?
How do we search for the value "Brian"?
Lab
Work on programming assignment

Partial preview of the text

Download CSIS 110 - Lecture 15: Arrays and ArrayLists - Prof. Brian F. Hanks and more Study notes Javascript programming in PDF only on Docsity!

CSIS 110 - Lecture 15

Announcements Quiz – next Wedsnesday Turn in Homework Let's look at some code for arrays and ArrayLists. First, let's declare an array and an ArrayList of String: private String[] theArray = new String[50]; private ArrayList = new ArrayList(); Now, what do we need to do to keep track of the size (the number of elements that contain data)?

  • ArrayList does it automatically for us
  • We need to use another variable to keep track of elements being used in the array: private int count = 0; Now, how do we put an element in the next position in the array or the ArrayList? [Don't forget about count]. How do we access an element at position i? [What happens if i < 0 or i >= count?] How do we print all of the values in the array or the ArrayList? How do we search for the value "Brian"? Lab Work on programming assignment