Positions

Practice creating arrays of objects and calling non-default constructors (unit 5).

Create an array of Tile objects based on the given parameter n where the object's value is based on its position-index into the array.

For example, the first object in the array is a Tile object with a value of 0 and the 2nd object in the array is a Tile object with a value of 1.

class Tile{

   private int value;

   public Tile(int val){
     value = val;
   }

   public int getValue(){
     return value;
   }
}

Type your solution        
Skills Practiced:
3.A
3.C
3.D
4.A
4.B
Copyright © StudyCS 2024 All rights reserved.