Amadeus interview question

core java puzzle