Java New Object Array Typescript Interview Question