Do if loops (in android/java) not execute properly if long variables are being used? I am trying to compare a value that is an int to a long using the == function, and it always passes as true. I've tried converting both to long and it also always evaluated as true. Can if statements not handle longs? Or conversions? Below is a sample of my code.
**Note, i was able to successfully execute by converting both to ints, but I'm not sure I will be able to do that once the database grows
for(int i = 1; i<99;i++){
long chalNum = addBet.getID();
if (chalNum == i){
//code executes every time through loop
//printed out i=2; chalNum = 32; then "inside loop"
}
Aucun commentaire:
Enregistrer un commentaire