About mCurrentIndex value

Why he didn’t just used " mCurrentIndex = (mCurrentIndex + 1) ; "
What is the benefit of ( % mQuestionBank.length ; ) in this code line,
mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length ;

The modulus operator (%) will loop the value back around. With mCurrentIndex + 1, if you hit the next question button 100 times, you will have a current index of 100 which is not a valid index into our list of questions.

The modulus operator takes the remainder of a division operation. So, if our mCurrentIndex + 1 value is 100 and we mod that by the size of the array (let’s say it’s 5 items long in this example): 100 % 5 = 0. So that will bring our index back to 0. The index can never grow to an invalid position because of that modulus operator.

To go back to the 1st question when you hit NEXT for ever…