a little OO practice in java