Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


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

3. Primitives and References: Know Your ... > An array is like a tray of cups

An array is like a tray of cups

  1. Declare an int array variable. An array variable is a remote control to an array object.

    int[] nums;
  2. Create a new int array with a length of 7, and assign it to the previously-declared int[] variable nums

    nums = new int[7];
  3. Give each element in the array an int value.

    Remember, elements in an int array are just int variables.

    image with no caption
    image with no caption

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint