Practice Java codes