Java practice example