Array Practice Problems


  1. Write a main method that asks the user for an integer n which then allocates an array of ints of that size and stores that many integers as the user enters them. Once they are all entered, print them in the reverse order of how they were entered.

  2. Write a method called setTo5 which is passed a reference to an array of ints and sets the contents of that array to all 5s.

  3. If a method is passed a reference to an array, is there any way to alter the size of that array so that the array reference that was passed in will refer to the new, larger array?