Kathryn shows you how to create different types of arrays in Java. She also explains how to access and set values inside of an array. And she describes several instance and static methods related to arrays.
- [Instructor] You may have seen this in other languages,…but an array is a container object…that stores a sequence of values that are all the same type.…This means it could hold many different values,…so we could have an integer array…that holds many different integers…like one, two, three.…However, I could not have an array of integers in strings…because an array can only contain data…of one particular type.…Usually, when we use an array,…we not only want to store these values,…but we want to be able to access…each individual value quickly.…
Each item in an array…is associated with a numerical index…starting at zero.…So if we have an array with five numbers,…say 31, 45, 22, 98, and 10,…in that order,…we can access them by index accordingly.…In this example,…if we wanted to access 31,…we would want to check index zero.…For 45, we would check index one,…for 22, index two,…for 98, index three,…and for 10, index four.…Let's try implementing this in code.…
So the numbers we had before were…31, 45,…22, 98, and 10.…To create an int array we would write…
- Downloading Java 9 and choosing an IDE
- Understanding Java basics: data types, strings, arrays, and more
- Controlling flow with functions and loops
- Working with inheritance and interfaces
- Learning lambda
Skill Level Beginner
1. Getting Started
2. Java Basics
3. Control Flow
4. Beyond the Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.