Question d’entretien chez IBM

Two java programs are given in Hackerrank test