CODING:
class logicaloperators{
public static void main(String args[])
{
//equivalent to 0101 in binary
int a=5;
//equivalent to 1000 in binary
int b=8;
//performing OR operation
int c= a|b;
//performing AND operation
int d=a&b;
//performing NOT operation
int f=~a;
System.out.println("a|b = "+c);
System.out.println("a&b = "+d);
System.out.println("~a = "+f);
}
}
No comments:
Post a Comment