Traditional Culture Encyclopedia - Hotel accommodation - In java? : What do you mean?

In java? : What do you mean?

Simply put, we can think of variables as a box. We can store keys, mobile phones, drinks and other items in this box, and if necessary, we can change them into new items we want to store.

In Java, we describe variables through three elements: variable type, variable name and variable value.

If we compare variables to hotel rooms, the data to be stored is just like the guests who want to stay. We can arrange for guests to stay in "standard room" or "presidential suite" according to their requirements, and we can quickly find the information of guests according to the room name. Similarly, in Java programs, we can also save data in a specified type of variable space according to the format of the data to be saved, and quickly locate it through the variable name!

For example, we define a variable? Love? To save a string? “imooc”? As long as you find the variable love in the program, you can find the "imooc" stored in it! Of course, we can also put? Love? Replace the value with a new string? I love imooc? !

Running results: