Week9Chap7-II - Chapter 7 Arrays Lecture II Janaka...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Janaka Balasooriya CSE 110, Arizona State University Chapter 7 Arrays - Lecture II
Image of page 1

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

View Full Document Right Arrow Icon
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
Image of page 2
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.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern