Operators in Java

Dear Sciaku Learner you are not logged in or not enrolled in this course.

Please Click on login or enroll now button.

If you have any query feel free to chat us!

Happy Coding! Happy Learning!

Lecture 12:- Operators in Java

In Java, operators are special symbols that perform specific operations on one or more operands (variables, constants, or literals). Java supports a wide range of operators that allow you to perform arithmetic, relational, logical, bitwise, and assignment operations, among others. Here are the main types of operators in Java:

  1. Arithmetic Operators:
    • + : Addition
    • - : Subtraction
    • * : Multiplication
    • / : Division
    • % : Modulus (remainder)
  2. Relational Operators:
    • == : Equal to
    • != : Not equal to
    • > : Greater than
    • < : Less than
    • >= : Greater than or equal to
    • <= : Less than or equal to
  3. Logical Operators:
    • && : Logical AND
    • || : Logical OR
    • ! : Logical NOT
  4. Bitwise Operators:
    • & : Bitwise AND
    • | : Bitwise OR
    • ^ : Bitwise XOR
    • ~ : Bitwise NOT (complement)
    • << : Left shift
    • >> : Right shift (with sign extension)
    • >>>: Right shift (zero-fill)
  5. Assignment Operators:
    • = : Simple assignment
    • += : Add and assign
    • -= : Subtract and assign
    • *= : Multiply and assign
    • /= : Divide and assign
    • %= : Modulus and assign
    • &= : Bitwise AND and assign
    • |= : Bitwise OR and assign
    • ^= : Bitwise XOR and assign
    • <<=: Left shift and assign
    • >>=: Right shift and assign (with sign extension)
    • >>>=: Right shift and assign (zero-fill)
  6. Increment and Decrement Operators:
    • ++ : Increment by 1
    • -- : Decrement by 1
    • These can be used as pre-increment (++num) or post-increment (num++).
  7. Conditional Operator (Ternary Operator):
    • ? : : Conditional expression (short for if-else)

The usage of these operators depends on the context and the data types involved in the operations. Understanding how to use these operators effectively is crucial for writing efficient and accurate Java programs.

4. Operators

0 Comments

Start the conversation!

Be the first to share your thoughts

Frequently Asked Questions About Sciaku Courses & Services

Quick answers to common questions about our courses, quizzes, and learning platform

Didn't find what you're looking for?

help_center Contact Support