vendredi 30 octobre 2015

if statement not working correctly - java

I have this code with "if" statement :

    if(svc.bfi==0){changeBackgroundOnHoverUsingEvents(fi, svc.bfi);}
    if(svc.bcr==0){changeBackgroundOnHoverUsingEvents(cr, svc.bcr);}
    if(svc.brf==0){changeBackgroundOnHoverUsingEvents(rf, svc.brf);}
    if(svc.bmo==0){changeBackgroundOnHoverUsingEvents(mo, svc.bmo);}
    if(svc.bev==0){changeBackgroundOnHoverUsingEvents(ev, svc.bev);}

In here, even if svc.bfi = 1, still the function changeBackgroundOnHoverUsingEvents(fi, svc.bfi); is being executed & displaying the results, and this applies to all other variables - bcr, brf, bmo & bev.

is my if statement incorrect?

Here is the svc class :

class setValClick{
public byte bfi = 0;
public byte bcr = 0;
public byte brf = 0;
public byte bmo = 0;
public byte bev = 0;

public void display(){
    System.out.println(bfi + " " + bcr + " " + brf + " " + bmo + " " + bev);
}

}

and the function I'm calling changeBackgroundOnHoverUsingEvents(fi, svc.bfi); is displaying the desired changes, i.e, it is displaying that svc.bfi = 1, but is still being executed.

Aucun commentaire:

Enregistrer un commentaire