1 The Problems
2 Answers
2.1 Things to Consider About the Answers

Practice Problems: Creating Classes and Objects

Try these problems, don’t just look at the answers. If you do look at the answers and find you made mistakes, write the answers out again by hand, even if you are mostly copying the answers. People learn differently from writing versus reading details: you are much more likely to absorb the pattern of defining classes if you actually write it down yourself. If you type instead of write by hand, don’t use cut and paste. You actually have to write out the characters yourself to help you absorb the patterns.

1 The Problems

2 Answers

Here is a link to classes for these questions. You might have used different names for the fields, but your answers should have been close to this. The Examples class is not complete, but just shows you one example of creating data in which one object contains another. Your Examples class should be much more extensive.

2.1 Things to Consider About the Answers