X Interview Question

some easy Java OOP implementation