Week9Chap7-II

Week9Chap7-II - Janaka Balasooriya CSE 110, Arizona State...

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

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Janaka Balasooriya CSE 110, Arizona State University Chapter 7 Arrays - Lecture II Janaka Balasooriya CSE 110, Arizona State University From the Last Lecture for loops can be used to manipulate data stored in an array Arrays work with input/output functions Today: length attribute of arrays Relationship between strings and arrays lowercase uppercase example Initializing arrays (initializing data items while declaring the array) Array Bound Checking Array of objects Array of string example Janaka Balasooriya CSE 110, Arizona State University In-class activity: Solutions Problem: Write a java program that asks the user to enter 10 integers (including negative numbers) from the keyboard and store them in an int array. Then, count how many negative numbers are in the array and display the negative count. With this example, we will learn how to use length attribute of arrays final SIZE= 10; int number = new int[SIZE ]; number.length attribute will have the SIZE of the array. We can use number.length -1 to specify the last index of the array. Janaka Balasooriya CSE 110, Arizona State University Strings vs. Arrays String can be considered as a character array. String can be considered as a character array....
View Full Document

This note was uploaded on 12/08/2010 for the course CSE 110 taught by Professor Kim during the Spring '08 term at ASU.

Page1 / 11

Week9Chap7-II - Janaka Balasooriya CSE 110, Arizona State...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online