I got quick question regarding Java less say i got provided with this code:
public void printNext(int x){
System.out.println((x+1) % 3);
}
public void printSequence(){
for (int i=0; i<5; i++) printNext(i);
}
The question is : 'What sequence of number is printed by printSequence()?'
Ok first its going do 0+1=1 and then invoking printNext method 1/3=0.333... (because of % operand means dividing) but the answer is 1,2,0,1,2 where did one came from 1/3 reminder is 3 not 1?