I would like to know why if I set eq = false in the secondPart method then change it to true in the removeAccess method(for the System.out.println shows that eq = true) but then back in the secondPart() the System.out.println shows that eq = false?
public void secondPart(){
boolean eq = false;
removeAccess(copy,d,eq);
System.out.println(eq);
}
private void removeAccess(List<Integer> copy, Integer letterNum,boolean eq){
for(int i =0; i<copy.size(); i++){
System.out.println("LetterNum:" + letterNum);
System.out.println("Copy:" + copy.get(i));
if(letterNum == copy.get(i)){
copy.remove(letterNum);
eq = true;
break;
}
else{
eq = false;
}
}
System.out.println("Eq:" + eq);
}