Challenges
Remember the rules for this are
- Try to use only the information given up to this point in this book.
- Try not to give up until you've given it a solid attempt
Challenge 1.
Take all the code you have written so far and put into one project.
To do this put everything under one src
folder just in different packages.
You will need to convert any usages of the anonymous main class into
named classes, but other than that it should be doable.
If you have already been doing that, just start making use of packages. They are, first and foremost, an organizational tool. Use them to organize your code as you see fit.
Challenge 2.
In the packages above have all the growable array implementations you were
asked to make in one package named collections
. Import these collections
wherever you want to use them with import collections.GrowableIntArray;
or similar declarations.
This will require marking the classes and many of the methods within public
.
Challenge 3.
Read through the list of packages that come with Java. You don't need to understand everything you are looking at; just browse and try to find at least one class that interests you.
Import that class and try to use it.