Statements & Escape Sequence
Java Variable & Data Type
Switch
Files Read and Write in Java
Type Conversion
Java Collection
Java Assignment operators
The assigning operator in Java is marked with the symbol “=”. The basic purpose of the assignment operator is to store the result of an expression or a constant value into a variable, allowing you to use and manipulate that value later in the program.
variable = expression or value;
Example:
It’s important to understand that the assignment operator does not check for equality (like the equality operator ==). Instead, it takes the value on the right and assigns it to the variable on the left.
The assignment operator can also be combined with other operators to perform arithmetic and bitwise assignments, like +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=, and >>>=. The combined assignment operators in Java allow you to perform arithmetic and bitwise operations on a variable and assign the result back to the same variable in a more concise manner. They combine the basic assignment operator “=” with other arithmetic or bitwise operators, making the code more compact and readable.