Java Code for  Learning Purpose