![]() ![]() This operator consists of three operands and is used to evaluate Boolean expressions. Conditional Operator ( ? : )Ĭonditional operator is also known as the ternary operator. There are few other operators supported by Java Language. It takes modulus using two operands and assign the result to left operand.īitwise exclusive OR and assignment operator.īitwise inclusive OR and assignment operator. ![]() It divides left operand with the right operand and assign the result to left operand. It multiplies right operand with the left operand and assign the result to left operand.ĭivide AND assignment operator. It subtracts right operand from the left operand and assign the result to left operand. It adds right operand to the left operand and assign the result to left operand. Assigns values from right side operands to left side operand.Ĭ = A + B will assign value of A + B into CĪdd AND assignment operator. If a condition is true then Logical NOT operator will make false.įollowing are the assignment operators supported by Java language − Use to reverses the logical state of its operand. If any of the two operands are non-zero, then the condition becomes true.Ĭalled Logical NOT Operator. If both the operands are non-zero, then the condition becomes true.Ĭalled Logical OR Operator. The following table lists the logical operators −Īssume Boolean variables A holds true and variable B holds false, then −Ĭalled Logical AND operator. The left operands value is moved right by the number of bits specified by the right operand and shifted values are filled up with zeros. The left operands value is moved right by the number of bits specified by the right operand. There are following relational operators supported by Java language.Īssume variable A holds 10 and variable B holds 20, then −Ĭhecks if the values of two operands are equal or not, if yes then condition becomes true.Ĭhecks if the values of two operands are equal or not, if values are not equal then condition becomes true.Ĭhecks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.Ĭhecks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.īinary Right Shift Operator. Multiplies values on either side of the operator.ĭivides left-hand operand by right-hand operand.ĭivides left-hand operand by right-hand operand and returns remainder. Subtracts right-hand operand from left-hand operand. The following table lists the arithmetic operators −Īssume integer variable A holds 10 and variable B holds 20, then −Īdds values on either side of the operator. We can divide all the Java operators into the following groups −Īrithmetic operators are used in mathematical expressions in the same way that they are used in algebra. Java provides a rich set of operators to manipulate variables.
0 Comments
Leave a Reply. |