Operators

There are many types of operators in java which are given below:
• Unary Operator,
• Arithmetic Operator,
• Shift Operator,
• Relational Operator,
• Bitwise Operator,
• Logical Operator,
• Ternary Operator and.
• Assignment Operator.
• Unary Operator,:- The unary operators operate on a single operand and following are the examples
of Unary operators − The increment (++) and decrement (--) operators. The unary minus (-) operator.
The logical not (!) operator.
• Arithmetic operator An arithmetic operator is a mathematical function that takes two operands and
performs a calculation on them. They are used in common arithmetic and most computer languages
contain a set of such operators that can be used within equations to perform a number of types of
sequential calculation.
• Shift operators, << (shift left), and >> (shift right), take two integers as operands. They return the result
of shifting the bits of the left operand by the number of positions specified by the right operand. The
left shift operator shifts bits to the left, and the right shift operator shifts bits to the right.
• Relational operator is a programming language construct or operator that tests or defines some kind of
relation between two entities. These include numerical equality (e.g., 5 = 5) and inequalities (e.g., 4 ≥ 3).
• Bitwise operator is an operator used to perform bitwise operations on bit patterns or binary numerals
that involve the manipulation of individual bits. Bitwise operators are used in: Communication stacks
where the individual bits in the header attached to the data signify important information.
• Logical operators are typically used with Boolean (logical) values. When they are, they return a Boolean
value. However, the && and. || operators actually return the value of one of the specified operands, so if
these operators are used with non-Boolean values, they will return a non-Boolean value.
• Ternary operator that is part of the syntax for basic conditional expressions in several programming
languages. It is commonly referred to as the conditional operator, inline if (iif), or ternary if.
An expression a ? b : c evaluates to b if the value of a is true, and otherwise to c .
• Assignment operator is equal ( = ), which assigns the value of its right operand to its left operand. That
is, x = y assigns the value of y to x . The other assignment operators are usually shorthand for standard
operations, as shown in the following definitions and examples.
Posted on by