Java-Bitwise NOT

Bitwise NOT( ~ ) The Bitwise NOT is represented by the symbol (~) . Bitwise NOT is an unary operator and inverts all the bits represented by its operand. That is, 0s become 1s and 1s become zero. Program Program Source public class Javaapp { public static void main(String[] args) { byte a = 3; byte b = … Read more…

Java-Bitwise Exclusive OR

Bitwise Exclusive OR( ^ ) The bitwise exclusive OR is represented by the symbol (^). The result of exclusive OR is 1 if only one bits of the bits is 1; otherwise it is zero. Program Program Source public class Javaapp { public static void main(String[] args) { int a = 10; int b = 12; int … Read more…

Java-Bitwise OR

Bitwise OR( | ) The Bitwise OR, is represented by the symbol | (vertical bar) and is surrounded by two integer operands. The result of OR operation is 1 if at least one of the bits has a value 1; otherwise it is zero. Program Program Source public class Javaapp { public static void main(String[] … Read more…

Java-Bitwise Operators

Bitwise Operators Java has a distinction of supporting special operators known as bitwise operators for manipulation of data at values of bit level. Bitwise operators can be applied to the interger types, byte, char, short, int and long. Bitwise operators may not be applied to float or double. Bitwise AND(&) The bitwise AND operator is … Read more…

Java-Ternary Operator

Ternary Operator The ternary operator is used to construct conditional expressions of the form : Here, Expression1 can be any expression that evaluates to a boolean value. If Expression1 is true, then Expression2 is evaluated; otherwise, Expression3 is evaluated. The result of the ‘?’ operation is that of the expression evaluated. Both Expression2 and Expression3 are required to … Read more…

Java-Boolean Logical Operators

Boolean Logical Operators The Boolean logical operators are used when we want to form compound conditions by combining two or more relations. Operator Meaning | Logical OR & Logical AND ^ Logical XOR ! Logical NOT The following table shows the effect of each logical operation : A B A | B A & B A … Read more…