How is an assignment statement used in JAVA.
Advertisements
प्रश्न
How is an assignment statement used in JAVA.
सविस्तर उत्तर
Advertisements
उत्तर
- In Java, an assignment statement is used to assign a value or the result of an expression to a variable. It is one of the basic statements used to store and update data in a program.
- An assignment statement uses the assignment operator (=). The variable to which the value is assigned is written on the left-hand side, while the value or expression is written on the right-hand side.
- When an assignment statement is executed, Java first evaluates the expression on the right-hand side and then stores the resulting value in the variable on the left-hand side. The assigned value must be compatible with the data type of the variable.
- Assignment statements are also used to modify or update the existing values of variables during program execution.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
