当前位置:网站首页>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
边栏推荐
- qt使用QZxing生成二维码
- 软件安装信息、系统服务在注册表中的位置
- 软件逆向破解入门系列(1)—xdbg32/64的常见配置及功能窗口
- [combinatorics] combinatorial identities (recursive combinatorial identities | sum of variable terms | simple combinatorial identities and | sum of variable terms | staggered sums of combinatorial ide
- Microservice - declarative interface call openfeign
- Automatic generation of client code from flask server code -- Introduction to flask native stubs Library
- 请做好3年内随时失业的准备?
- 【OpenCV 例程200篇】217. 鼠标交互获取多边形区域(ROI)
- CString getbuffer and releasebuffer instructions
- Srs4.0+obs studio+vlc3 (environment construction and basic use demonstration)
猜你喜欢

Visual upper system design and development (Halcon WinForm) -1 Process node design

nifi从入门到实战(保姆级教程)——flow

Tensorflow realizes verification code recognition (I)

ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装

String functions that you need to know

Function introduction of JMeter thread group

详解指针进阶2

突破100万,剑指200万!

Jvm-09 byte code introduction

Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)
随机推荐
CString的GetBuffer和ReleaseBuffer使用说明
Popular understanding of linear regression (I)
MB10M-ASEMI整流桥MB10M
Vs2017 is driven by IP debugging (dual machine debugging)
“用Android复刻Apple产品UI”(2)——丝滑的AppStore卡片转场动画
Digital image processing -- popular understanding of corrosion and expansion
Visual upper system design and development (Halcon WinForm) -2 Global variable design
Visual upper system design and development (Halcon WinForm) -5 camera
Go language self-study series | if else if statement in golang
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
Shell script import and export data
坚持输出需要不断学习
整形和浮点型是如何在内存中的存储
2022年Q2加密市场投融资报告:GameFi成为投资关键词
Baidu AI Cloud helps Shizuishan upgrade the smart health care model of "Internet + elderly care services"
秒殺系統3-商品列錶和商品詳情
【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
win32创建窗口及按钮(轻量级)
Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)
Break through 1million, sword finger 2million!