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

Arrays: A Convenient Way to Store Similar Data Types, Slides of Java Programming

An introduction to arrays, explaining what they are, how to declare and initialize them, and how to access their elements. Arrays are useful for storing similar data types and are indexed starting from zero. Examples in java and provides resources for further learning.

Typology: Slides

2012/2013

Uploaded on 04/23/2013

sarmistha
sarmistha 🇮🇳

3.8

(22)

113 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Arrays
Docsity.com
pf3
pf4
pf5
pf8

Partial preview of the text

Download Arrays: A Convenient Way to Store Similar Data Types and more Slides Java Programming in PDF only on Docsity!

Arrays

Announcements

55 people answered the survey Wednesday is review and ungraded quiz Remember midterm on Friday! Post-HW2 midterm material questions today Sample midterm tomorrow

Arrays

Arrays are convenient ways to store similar data types Much like how we have been thinking of Strings as a list of characters Arrays are also indexed starting from zero

Arrays - declare/initialization

When making an array, you need both a type and a length. The format for making an array is below: Type, [] means array variable name length of array

Arrays - manual initialization

Arrays can be initialized by the following: If you try an access an array element that has not been initialized, your program will crash Arrays have a .length variable (similar to Strings) (See: ArrayPrintf.java)

Arrays

A char array is not a String While the important data in String is a char array, classes have methods unlike arrays More examples: (See: ArrayAverage.java) (See: Fibonacci.java)