Altimetrik Interview Question

2 coding questions, core java and java 8