# bitwise operators

buwaneka paranamana
bitwise operators
2 Answer(s)      4 years and 3 months ago
Posted in : Java Beginners
```include<stdio.h>

int main(){
short x;
x=3 | 5;
printf("%d \n",x);
return 0;
}
```

why this program give the answer as 7

June 1, 2013 at 10:29 AM

hi friend,

Bitwise OR (|) operator returns 1 if either side of operand is 1 else it returns 0 i.e. in this case the bitwise or operator returns 0 (zero) if and only if both side of operand is zero.

```So, the binary representation of 3 is = 0011
and the binary representation of 5 is = 0101
When you will apply the or operator    ------
then the binary representation will be  0111
------
```

And the decimal representation of 0111 = 7, that's why your output is given to 7.

June 1, 2013 at 11:04 AM

hi friend,

http://www.roseindia.net/java/master-java/java-bitwise-or.shtml

bitwise operators
bitwise operators  Write short note on bitwise operators of Java.   Please visit the following links: http://www.roseindia.net/java/java-tips/data/expressions/slides-bitops.shtml http://www.roseindia.net/java/java
bitwise operators
bitwise operators  include<stdio.h> int main(){ short x... this program give the answer as 7  hi friend, Bitwise OR (|) operator returns 1 if either side of operand is 1 else it returns 0 i.e. in this case the bitwise
Bitwise Operators in java 7
In this section you will learn about the Bitwise Operators. This is one type of operators
bitwise operators accept type char as operands
bitwise operators accept type char as operands   Why bitwise operators accept type char as operands
Bitwise and Bit Shift Operators
Bitwise and Bit Shift Operators       In Java the bitwise and bit shift operators are used.... These operators perform bitwise and bit shift operations on integral type
adding two numbers using bitwise operators
adding two numbers using bitwise operators  adding two integer numbers with using bitwise opeators   Hi Friend, Try the following code: public class AddNumberUsingBitwiseOperators { public static void main(String
Java Bitwise Operator
; In computer, the bitwise operators as their name suggests actually work... (or characters). However in Java, the bitwise and bit shift operators are used.... These operators perform bitwise and bit shift operations on integral type
Operators
to a specified type  Bitwise and Bit Shift Operators ~   Unary bitwise... Operators       Operators are symbols that performs some operations on one or more then one operands
Operators
to a specified type  Bitwise and Bit Shift Operators ~   Unary bitwise... Operators       Operators are symbols that performs some operations on one or more then one operands
Operators
to a specified type  Bitwise and Bit Shift Operators ~   Unary bitwise... Operators       Operators are symbols that performs some operations on one or more than one operands
Operators
to a specified type  Bitwise and Bit Shift Operators ~   Unary bitwise... Operators       Operators are symbols that performs some operations on one or more then one operands
Java bitwise OR "|" operator
example using Bitwise (OR) "|" operator. public class Operators...Java bitwise OR "|" operator In this section you will learn about how to use" |" operator in java. Java provides six types of operators
Operators and Expressions
Bitwise and Bit Shift Operators... Operators and Expressions       Operators: Operators are such symbols that perform some
ciruit operators.
ciruit operators.  Explain the benefit of short ciruit operators
Java Bitwise NOT "~" Operator
Java Bitwise NOT "~" Operator       In this section, you will learn how to use bitwise NOT "~" operator in Java. The Java programming language has operators
Java Bitwise XOR "^" Operator
Java Bitwise XOR "^" Operator       In this section, you will learn how to use bitwise XOR "^" operator in Java. The Java programming language has operators
Java operators
Java operators  What is the difference between the >> and >>> operators
Java XOR operator
Java XOR operator       Java makes available the bitwise operators like AND, OR, XOR, and NOT. .../master-java/java-bitwise-xor.shtml http:/www.roseindia.net/software-tutorials
Java Bitwise AND " &" Operator
bitwise AND " &" operator in Java. The Java programming language has operators that perform bitwise operations. In the example below we have shown... Java Bitwise AND " &" Operator
Java Bitwise OR " |" Operator
Java Bitwise OR " |" Operator       In this section, you will learn how to use bitwise OR "|" operator in Java. The Java programming language has operators that perform
Operators In Java
Operators :   ~ : A unary bitwise complement operator that applied to any...Operators In Java In this section we will read about operators in Java. We will illustrate the use of operators in Java using a simple example. Java
boolean operators in JavaScript
boolean operators in JavaScript  What boolean operators does JavaScript support
logical operators in objective c
logical operators in objective c  logical operators in objective c
SQL AND Operators
SQL AND Operators       The AND operator displays records if both conditions are true. 1st Condition 2nd Condition Result false
SQL OR Operators
SQL OR Operators       The OR operator displays records if any of the conditions is true. 1st Condition 2nd Condition Result false
php Operators
php Operators:       Operators are one of the important feature of every language. In php operators... Assignment Operator Logical Operator String Operator Bitwise Operator Error Control
Unary Operators in java 7
In this section you will learn about the Unary operators. This is one type of operators
Arithmetic Operators in java 7
In this section you will learn about the Arithmetic operators. This is one type of operators