Pair programming exercise in Java