Menu

Java Operators

Java operators :

The usual arithmetic operator + -*/ are used in java for addition ,subtraction, multiplication, and division. The / operator denotes integer division if both arguments are integer, and floating-point division.

Operators An operator is a symbol that takes one or more arguments and operates on them to produce a result. Operators are used in programs to manipulate data and variables. Arithmetic Operators Arithmetic operators are used to construct mathematical expressions. The usual arithmetic operator +, -, *, / are used in java for addition, subtraction, … Read more…

Arithmetic Compound Assignment Operators Java provides special operators that can be used to combine an arithmetic operation with an assignment. As you probably know, statements like the following are quite common in programming : In Java, you can rewrite this statement as shown here : This version uses the += compound assignment operator. Both statements … Read more…

Increment and Decrement operators Java has two very useful operators. These are the increment and decrement operators : The operators ++ adds 1 to the operand while – – subtracts 1. For example, the code changes ‘totel’ to 6. Because these operators change the value of ‘totel‘ variable, they cannot be applied to numbers themselves. … Read more…

Relational Operators We often compare two quantities, and depending on their relation, take certain decisions. For example, we may compare the age of two persons, or the price of two items, and so on. These comparisons can be done with the help of relational operators. The value of relational expression is either true or false. … Read more…

Boolean Logical Operators The Boolean logical operators are used when we want to form compound conditions by combining two or more relations. Operator Meaning | Logical OR & Logical AND ^ Logical XOR ! Logical NOT The following table shows the effect of each logical operation : A B A | B A & B A … Read more…