ICSE Class 10 Computer Applications Question 4 of 26

Operators in Java — Question 4

Back to all questions
4
Question

Question 4

What is an assignment operator? Give an example.

Answer

Assignment operator is used to assign the value of an expression to a variable. It has the following syntax:

variable = expression;

For example,

totalMarks = 780;

The above statement assigns the value of 780 to the variable totalMarks. Any previous value stored in totalMarks variable is overwritten by this new value.