Operator Java

Why Trust Techopedia

What Does Iterative Development 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 Iterative Development

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.

Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.