In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge about what the GE value type and reference type are. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article, let's take a look at it.
Value type and reference type
All basic types such as int, float, bool, and string are value types, and variables that use these types point directly to values that exist in memory:
When you use the equal sign = to assign the value of one variable to another, such as: J = I, you actually copy the value of I in memory:
You can use & I to get the memory address of variable I, for example: 0xf840000040 (the address may be different each time).
The value of a value type variable is stored in the heap.
Memory addresses vary from machine to machine, and even the same program will have different memory addresses after it is executed on different machines. Because each machine may have a different memory layout, and the location allocation may also be different.
More complex data usually requires the use of multiple words, which are generally saved using reference types.
A variable R1 of a reference type stores the memory address (number) where the value of R1 is located, or the location of the first word in the memory address.
This memory address is called a pointer, and the pointer is actually stored in another value.
Pointers of the same reference type can point to multiple words in contiguous memory addresses (the memory layout is contiguous), which is the most computationally efficient form of storage, or they can be scattered in memory. each word indicates the memory address of the next word.
When the assignment statement R2 = R1 is used, only the reference (address) is copied.
If the value of R1 is changed, all references to that value will point to the modified content, and in this case, R2 will also be affected.
These are all the contents of the article "what are GE value types and reference types". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.