This article is about the use of operators in Java.
Operators are characters or symbols that tell the Java compiler to perform a specific mathematical or logical manipulation. Java has four types of operators, arithmetic, bitwise, relational, and logical. There is also the standard assignment operator as well.
Arithmetic operators are used with numerical values to perform different mathematical operations. Listed below are the Java Arithmetic Operators.
|Addition||+||Sum of two numbers.|
|Subtraction||–||Difference of two numbers.|
|Multiplication||*||Product of two numbers.|
|Division||/||Division of two numbers.|
|Modulus||%||Remainder of the division of two numbers.|
|increment||++||increments the number by 1|
|decrement||—||Decrements the number by 1|
Arguably the most common, Assignment Operators are used to assign values to variables. See the full list of Assignment operations below.
Comparison Operators compare the contents of a variable to another. If the Comparison held true, then the Boolean value “True” is returned. However if the comparison was false, then the Boolean value “False” is returned.
| ||Equals to|
| ||Not Equal to|
| ||Greater than|
| ||Greater than or equals to|
| ||Less than|
| ||Less than or equals to|
Used to conduct Logical Operations between conditional statements.
|and||Returns True if both of the two statements was True.|
|or||Returns True if one of the two statements was True.|
|not||Inverses the result.|
This marks the end of the Operators in Java Article. Any suggestions or contributions for CodersLegacy are more than welcome. Any questions can be asked below in the comment.