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.

 

Disclaimer:-

Under Section 107 of the copyright act 1976, allowance is made for fair use for purposes such as criticism, comment, news reporting, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational, or personal use tips the balance in favor of fair use.

 

4. Operators

Comments: 0

Frequently Asked Questions (FAQs)

How do I register on Sciaku.com?
How can I enroll in a course on Sciaku.com?
Are there free courses available on Sciaku.com?
How do I purchase a paid course on Sciaku.com?
What payment methods are accepted on Sciaku.com?
How will I access the course content after purchasing a course?
How long do I have access to a purchased course on Sciaku.com?
How do I contact the admin for assistance or support?
Can I get a refund for a course I've purchased?
How does the admin grant access to a course after payment?