ARRAY
An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. Many people have seen examples of an array already but dont really notice it. We have seen in already in the main method of the "Hello World!" application.
Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 0. The 9th element, for example would therefore be accessed at index 8.
What I learned?
What I learned while doing this unit basically was how to use an array and what an array is. Coming into this unit I had no clue how to use it but now I have some sort of idea how to use it in a piece of code. What an array is useful is, is that by using arrays to can easily make lists of variables using only one command. Arrays I learned are also useful because instead of making a long list of If, Else statements you can just use arrays and save lots of time in writing your code. So how exactly do you reference variables in an array?
In Java all values, or data stored in an array is assigned a number value starting with 0. If i were to print x[0] from above the output would be "a". If i were to print x[1] the output would be "b".

http://apcompsciencecoding.blogspot.com/
ReplyDeleteCheck it out! ^ this guy has the the exact same post as you...weird.
This comment has been removed by a blog administrator.
ReplyDelete