Tata Power SED interview question

basics in java,