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. Data Types in Java with example
        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 with example
        11. Method Overloading in Java with example
        12. Method Overriding in Java with example
        13. Static Members in Java with Program
        14. Abstract Class in Java with Program
        15. final, finally and finalize in Java
        16. Dynamic Method Dispatch in Java | Runtime Polymorphism
        17. Nesting of Methods in java
        18. Inheritance in Java with example
        19. Java Access Modifiers – Public, Private, Protected, Friendly
        20. Array in Java
        21. Strings in Java | String Methods
        22. StringBuffer class in Java with Program
        23. Vector in Java | Vector Methods
        24. Wrapper Classes in Java With Program
        25. Autoboxing and Unboxing in Java With Program
        26. enum in Java with Program
        27. Java Annotation
        28. Interface in Java with Program
        29. Difference between Class and Interface in Java
        30. Implementing Interfaces in Java
        31. Java Program to implement Multiple Inheritance using Interface
        32. Difference Between Multithreading and Multitasking in Java
        33. Life Cycle of Thread in Java with Diagram
        34. Synchronization of threads in Java
        35. Java Thread Priority
        36. Java Program to Implement Multithreading using Runnable Interface
        37. Inter-thread Communication in Java
        38. Suspend, Resume and Stop Thread in Java
        39. Types of Error in Java
        40. Exceptions in Java
        41. Exception Handling in Java with examples
        42. Java Package
        43. Static import in Java
        44. Design a package to contain class Student and package contain interface Sports