What is Java program operator and their type

Sandipan Kr Bag Apr 07, 2024
What  is Java program operator and their type

What is java operator ?

In Java, an operator is a symbol that performs an operation on one or more operands. Operators can perform mathematical, logical, relational, bitwise, and assignment operations. Java supports various types of operators, including arithmetic, bitwise, relational, logical, assignment, and unary operators.

Different types of operators available:

1. Arithmetic Operators: Used for basic arithmetic operations like addition (`+`), subtraction (`-`), multiplication (`*`), division (`/`), and remainder (`%`).

 

2. Bitwise Operators: Used to perform bitwise operations on integral types. Includes bitwise AND (`&`), bitwise OR (`|`), bitwise XOR (`^`), bitwise complement (`~`), left shift (`<<`), and right shift (`>>`).

 

3. Relational Operators: Used to compare two values. Includes equal to (`==`), not equal to (`!=`), greater than (`>`), less than (`<`), greater than or equal to (`>=`), and less than or equal to (`<=`).

 

4. Logical Operators: Used to perform logical operations. Includes logical AND (`&&`), logical OR (`||`), and logical NOT (`!`).

 

5. Assignment Operators: Used to assign values to variables. Includes simple assignment (`=`), compound assignment (e.g., `+=`, `-=`, `=`, `/=`), and bitwise assignment (e.g., `&=`, `|=`, `^=`).

 

6. Unary Operators: Operate on a single operand. Includes unary plus (`+`), unary minus (`-`), increment (`++`), decrement (`--`), and logical complement (`!`).

 

7. Ternary Operator (Conditional Operator): A ternary operator `? :` is used for conditional expressions. It evaluates a boolean expression and returns one of two values depending on whether the expression is true or false.

 

Share this article

sndp bag

Sandipan Kr Bag

I'm a dedicated full-stack developer, entrepreneur, and the proud owner of ocec.org.in , hailing from the vibrant country of India. My passion lies in creating informative tutorials and sharing valuable tips that empower fellow artisans in their journey. With a deep-rooted love for technology, I've been an ardent enthusiast of PHP, Laravel, Angular, Vue, Node, JavaScript, jQuery, Codeigniter, and Bootstrap from their earliest days. My philosophy revolves around the values of hard work and unwavering consistency, driving me to continuously explore, create, and share my knowledge with the tech community.

* Hire Me

0 Comments

Load more Comments

Post a Comment

Hint: Please enter between 80 - 300 characters.
ocec.org.in

helllo