当前位置:网站首页>The difference between calling by value and simulating calling by reference
The difference between calling by value and simulating calling by reference
2022-07-03 15:54:00 【Zhangjian Tianya 2.0】
First :
Basic data type :8 Kind of byte short int long (4 Kind of ) float double( floating-point ) boolea( Boolean type ) char( Character type )
Reference data type :class,interface,array Arrays and so on

The reference data type must be stored in the heap , But its variable name is stored in the stack, storing a lot of information about the data in the heap
When making array names equal directly , Or let class,interface Examples created , When making the examples equal , It is equivalent to assigning its addresses together : When the A When the example is operated , In fact, it will be right B Example to operate , The relationship between the two is similar to that in the figure C and D The relationship between
But when the basic data type is assigned , Is value passing reference ,
int A=30;
int B=A;
B=20;
For B Assignment does not affect A Value
int [] A=new int[3];// A piece of memory is created in the stack memory Store A And point to three pieces int Heap memory of array memory address
int [] B =A;
A[0]=30;// here B[0] The value of 30
// A memory is created in the stack memory to store variables B And will be A The address of is assigned to B among , Then in the heap memory ,A and B Point to and execute the same memory
边栏推荐
猜你喜欢

Nifi from introduction to practice (nanny level tutorial) - flow

Creation and destruction of function stack frames

UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)

Summary of JVM knowledge points

Tensorflow realizes verification code recognition (III)

Please be prepared to lose your job at any time within 3 years?

关于网页中的文本选择以及统计选中文本长度

需要知道的字符串函数

Popular understanding of gradient descent

Unityshader - materialcapture material capture effect (Emerald axe)
随机推荐
UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)
整形和浮点型是如何在内存中的存储
Reading notes of "micro service design" (Part 2)
Semi supervised learning
《微服务设计》读书笔记(上)
Popular understanding of gradient descent
Microservice - Nacos registration center and configuration center
Tensorflow realizes verification code recognition (II)
Win10 enterprise 2016 long term service activation tutorial
【OpenCV 例程200篇】217. 鼠标交互获取多边形区域(ROI)
【Proteus仿真】74HC595+74LS154驱动显示16X16点阵
Function introduction of JMeter thread group
Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)
Subclass hides the function with the same name of the parent class
ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装
Microservice - declarative interface call openfeign
Srs4.0+obs studio+vlc3 (environment construction and basic use demonstration)
Get the executable path through the process PID (queryfullprocessimagename)
六月 致 -.-- -..- -
How to use annotations such as @notnull to verify and handle global exceptions