Step 11

Testing the “RandomPicker” class


Now let’s try testing out the “RandomPicker” class! Open up the “Main” file and add the code as shown.

This code will create a “RandomPicker” instance called “rp.” In this example, we add 3 numbers to it and pick 3 numbers at random from it. Feel free to add/pick more/less numbers if you want!

Once you run the code, you should see something similar to what is shown here. If not, double check your code for any errors.

Congrats! This marks the end of project 1. There was a LOT covered in this project, but it is all necessary for future projects. The things we coded in this project may have seemed a bit random, because they were. The main point of this project was to show you the key tools programmers use in Java programming, tools that will be used a lot in our future projects. In the next project, we will work on something a little less random and with a bit more of a purpose to it.