+ 2
What is operator
4 odpowiedzi
+ 2
The assignment operator (=) is the most commonly used binary operator in Java. It evaluates the operand on the tight hand side and then assigns the resulting value to a variable on the left hand side. The right operand can be a variable, constant, function call or expression. The type of right operand must be type compatible with the left operand. The general form of representing assignment operator is
Variable = expression/constant/function call
a = 3; //constant
x = y + 10; //expression
In the first case, a literal value 3 is stored in the memory location allocated to variable a. In the second case, the value of expression y+ 10is evaluated and then stored in memory allocated to
variable x.
Consider a statement x = y = z = 3;
Such type of assignment statement in which a single value is given to a number of variables is called multiple assignment statement i.e. value 3 is assigned to the variables x, y and z. The assignment operator
+ 1
anu ..
Operators are the symbols that are used to perform operations on operands. For example: +, -, *, / etc.
There are many types of operators in java :
Arithmetic Operator(+, -, *, /, %)
shift Operator(<<, >>, etc.)
Relational Operator(==, <=, etc)
Bitwise Operator(&, ^, etc)
Logical Operator(&&, ||, etc)
Assignment Operators(=, >=, <=, /=, etc)
Increment /decrement operators(++, - -).
+ 1
nice ashu