Definition - What does Operator mean?
An operator, in Java, is a special symbols performing specific operations on one, two or three operands and then returning a result. The operators are classified and listed according to precedence order. Java operators are generally used to manipulate primitive data types. The Java operators are classified into eight different categories: assignment, arithmetic, relational, logical, bitwise, compound assignment, conditional and type comparison operators.
Techopedia explains Operator
Assignment operators: Assign the value on its right to the operand on its left. It is denoted by the symbol “=”. The assignment operator statement has the syntax as shown below: int distance = 0 int radius = 2 Arithmetic operators: There are eight arithmetic operators available in Java. They perform addition, subtraction, multiplication, division, modulo (or remainder), increment (or add 1), decrement (or subtract 1), and negation. + Additive operator (also used for String concatenation) -Subtraction operator * Multiplication operator / Division operator % remainder operator Relational Operators: The relational operators are used to compare 2 or more objects. There are six relational operators in Java: == equal to != not equal to >> greater than >= greater than or equal to < less than <= less than or equal to Logical operators: The logical operators return a true or false value according to the state of the variables. Java provides six logical operators: AND, OR, Conditional OR, exclusive OR, and NOT. Bitwise operators: Manipulate the contents of variables at the bit level. The data type of these variables must be numeric (char, int, long, short). There are seven bitwise operators. They are AND, OR, Exclusive-OR, compliment, Left-shift, Signed Right-Shift, and Unsigned Right-shift. Compound operators: Are used when shortcuts need to be performed in programming operations. There are eleven compound assignment operators in java. The syntax for compound operators is: argument 1 operator = argument2. Conditional operators: The conditional operator is the only operator that takes three arguments in Java. The conditional operator is equivalent to if-else statement. The operators are: && conditional- AND | |-conditional-OR The operator first assesses the first argument and if that is true, it assesses the next argument. If the first becomes false, then the control moves to the third argument. Type comparison operators: The instanceof operator compares an object to a specified type. This operator can be used to test if an object is an instance of a class, subclass or a particular interface.
"Techopedia" on Twitter
Sign up for Techopedia's Free Newsletter!
Join thousands of others with our weekly newsletter
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.