• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. Arrays > Creating an Array

Creating an Array

Now that you know what an array is and what it does, let's discuss how to create one. There are several different ways to create an array; however, we will be dealing mainly with the new operator and the Array constructor to build our sample array.

When creating arrays using the new operator and the Array constructor, start by setting a variable. Then make the variable equal to the new operator combined with the Array constructor, followed by a set of parentheses and then a semicolon (to end the line of code). Here's an example:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint