Various code while studying Java