vendredi 20 juillet 2018

How a given if condition is giving true in java

I am unable to understand why following if blocks execute. How the if conditions will be evaluated?

public class Test
{
    public static void main(String[] args)
    {
        if (true || (false ||  true) && false)
        {
            System.out.println("How does this condition becomes true.");
        }

        if (false && (false ||  true) || true)
        {
            System.out.println("Same with this condition, why is it true.");
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire