Write a programto demonstrate the use of
shorthand assignment operator (with using
scanner class and object)
و را
Answers
Answer:
Java Operators
Java Operators
In this tutorial, you'll learn about different types of operators in Java, their syntax and how to use them with the help of examples.
Operators are special symbols (characters) that carry out operations on operands (variables and values). For example, + is an operator that performs addition.
In the previous tutorial, you learn about Java Variables. You learn to declare variables and assign values to variables. Now, you will learn to use operators to manipulate variables.
Assignment Operator
Assignment operators are used in Java to assign values to variables. For example,
int age; age = 5;
The assignment operator assigns the value on its right to the variable on its left. Here, 5 is assigned to the variable age using = operator.
There are other assignment operators too. However, to keep things simple, we will learn other assignment operators later in this article.