divya srivastava

divya srivastava

1 Articles Published

Articles by divya srivastava

1 articles

Initializing multiple variables to the same value in Java

divya srivastava
divya srivastava
Updated on 23-Sep-2024 1K+ Views

In this article, we will learn to initialize multiple variables to the same value in Java. What is a variable? A variable is a name given to a space reserved in the memory. Every variable has a type which specifies what kind of data it holds. Initializing multiple variables to the same value Multiple variables can be initialized to the same value in one statement as: variable1 = variable2 = variable3 = value This means that the value is assigned to variable3, then variable3 is assigned to variable2, and finally, variable2 is assigned to variable1. Input 1 a ...

Read More
Showing 1–1 of 1 articles
« Prev 1 Next »
Advertisements