Infosys interview question

about java classes and other logics in java