Operators in Java

An operator is a symbol that tells the computer to perform certain mathematical or logical manipulations. Operators are used in programs to manipulate data and variables. Java supports a rich set of operators.
Java operators can be classified into 8 categories are given as below :

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Assignment Operators
  • Increment and decrement operators
  • Conditional Operators
  • Special Operators
  • Bitwise Operators
  • 1. Arithmetic Operators: Arithmetic Operators are used to constructing mathematical expressions as in algebra. Java provides all the basic arithmetic operators.


    2. Relational Operators: When we compare two quantities and depending on their relation, then we used some relational symbol that is called Relational Operators.

    <less than
    <=less than or equal to
    >greater than
    >=greater than or equal to
    (==)equal to
    !=not equal to

    3. Logical Operators: An expression that combines two or more relational expressions is called Logical Operators or Compound Operators.

    &&logical AND
    ||logical OR
    !logical NOT

    4. Assignment Operators: Assignment Operators are used to assigning the value of an expression to a variable.

    5. Increment and decrement operators : Java has two useful operators and these are the Increment and decrement operators.
    + + and – –

    6. Conditional Operators: The character pair ?: is a ternary operator, it is used to construct conditional expressions that are called Conditional Operators.

    7. Special Operators: Java supports some special operators such as instanceof opeartor and member of selection operator or dot operator (.) .

    8. Bitwise Operators: Java has a distinction of supporting special operators that are known as Bitwise Operators. It is used to manipulate data at values of bit-level and also used for testing the bits or shifting them to the right or left. Bitwise Operators may not be applied to float or double data types.

    &bitwise AND
    !bitwise OR
    ^bitwise exclusive OR
    ~One's Complement
    <<Shift left
    >>Shift right
    >>>Shift right with zero fill

    Recommended Posts:

        1. Features of Java
        2. Java Program Structure
        3. Command Line Arguments in Java
        4. Difference between java and c++
        5. Java Data Types
        6. Scope of Variables in Java
        7. Operators in Java
        8. Looping Statement in Java
        9. Objects and Classes in Java
        10. Constructors in Java
        11. Method Overloading in Java with Program