Code while learning java as a beginner