Reference is not a known side

zhaozj2021-02-16  64

Source: http://blog.9cbs.net/chensheng913/Archive/2004/07/18/44556.aspx

Java does not support Pointer, only providing Reference, and initiators are often quite confused, especially those who have repaired data structures. The first thing in their heart is: "There is no Pointer, how to become, then don't do it Data structure of LINKED LIST and TREE? "Seeking that Reference is a smart Pointer, which has the benefits of Pointer, and does not need to be used as a programmer as a programmer, and notleference (&), not like Pointer. The same will cause Crash. Because there are a lot, Reference is already an important necessary feature of modern program language. what! You said that the XX high-level language does not support Reference, then you can bury it in the history ash of the twentieth century. Java's processing method is: as long as it is a basic type (including Boolean, Byte, Short, Int, Long, Float, Double, Char), PASS BY VALUE is used, and other types will be passed by Reference. But I found that this is possible in the future, because Java Language will bind ByValue to Reserved Word (non-Keyword). When Java turns BYVALUE to Keyword, the value of non-basic state can pass by value, but I believe that Java must also start supporting Copy Constructor as a supporting measures, after all, using Deep Copy or ShaLlow Copy (even DEEP And ShaLlow and ShaLLOW's COPY is still to make Programmer decide. Previously: As long as it is a basic state (including Boolean, Byte, Short, Int, Long, Float, Double, Char), Pass By Value, other types of PASS BY REFERENCE. What is Pass By Value? What is Pass by reference? For a few more, Pass by value is the information of "Bordering". Pass by Reference is the information of "this respect" passed. (Note: Since the news that happened this news, after the noun of "Duty" and "Framed", I found that it is easy to explain the concept of Reference Reference to students). Because the object is a pass by reference, an object is often referred to simultaneously by multiple Variable. Java provides mechanisms for automatic memory management, which is commonly known as Garbage Collection. When an object is no longer referred to by any Variable, it is not possible to use this object. The Java virtual machine is responsible for collecting the garbage in the appropriate timing to reclaim this block. I will remember when James Gosling in Java is invited to Taiwan (December 1997), I have asked him: This automatic memory management method of Java causes some programs (such as debugger), and Java is intended to support Weak Reference. James gosling Answer: The future version will support Weak Reference, which is only available in the later JDK 1.2.

转载请注明原文地址:https://www.9cbs.com/read-15374.html

New Post(0)