add 2nd exercise in java