Capgemini interview question

two programs and some core java questions