NTT DATA interview question

Memory management in java