Sunday, March 25, 2018

Logical operator of Java Programme

/* Example of Logical Operator */
package Logical;
public class Logical
{
    public static void main(String[] args)
    {
        boolean a = true, b = true , c = false, result;
        prln("a = "+a+"\t b = "+b+ "\t c = "+c);
        result = a && b || c;
        prln("a && b || c = "+result);
        result = a || b && c;
        prln("a || b && c = "+result);
        result = a && !a;
        prln("a && !a = "+result);
        result = a || !a;
        prln("a || !a = "+result);
        result = c && !c;
        prln("c && !c = "+result);
        result = c || !c;
        prln("c || !c = "+result);
     
    }
    static void prln(Object anyObject)
    {
        System.out.println(anyObject);
    }
    static void pr(Object anyObject)
    {
        System.out.print(anyObject);
    }
 
}












Share:

0 comments:

Post a Comment

Blogger templates