Naavinya CAD Soft interview question

Questions are from java