课程: Java Essential Training: Syntax and Structure

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Arrays

Arrays

- [Instructor] Variables are capable of holding a single value. Arrays are special variables that act as containers which can hold multiple values. Here's a typical variable which is declared as a string and can hold a single value. But what if we want to represent a collection of variables as one entity? For example, what about all six of the hockey team players that are currently on the ice? We can do so within an array. This is the declaration for an array. The first part is the data type that the array holds. And while the array is capable of holding multiple values, all values must be of the same data type. The square brackets indicate that this is not just a string data type, but this will be an array of strings. The bracket can appear after the data type or after the variable name itself. Speaking of name, that's the next part of the declaration. We name arrays just as we would any other variable. The name is…

内容