当前位置:网站首页>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
边栏推荐
- Redis installation under windows and Linux systems
- Function introduction of JMeter thread group
- Please be prepared to lose your job at any time within 3 years?
- Vs2017 is driven by IP debugging (dual machine debugging)
- Microservice - Nacos registration center and configuration center
- Automatic generation of client code from flask server code -- Introduction to flask native stubs Library
- do{}while()的妙用
- leetcode_ Power of Four
- 一些事情的反思
- qt使用QZxing生成二维码
猜你喜欢

工资3000,靠“视频剪辑”月入40000:会赚钱的人,从不靠拼命!

About text selection in web pages and counting the length of selected text

Microservices Seata distributed transactions

Three dimensional reconstruction of deep learning

Unity function - unity offline document download and use

Microservices - load balancing ribbon

从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍

Download and install common programs using AUR

String functions that you need to know
![App mobile terminal test [5] file writing and reading](/img/f1/4bff6e66b77d0f867bf7237019e982.png)
App mobile terminal test [5] file writing and reading
随机推荐
Calibre LVL
Srs4.0+obs studio+vlc3 (environment construction and basic use demonstration)
A Fei's expectation
Creation and destruction of function stack frames
Second kill system 3 - list of items and item details
win32创建窗口及按钮(轻量级)
Distributed task scheduling XXL job
函数栈帧的创建和销毁
GCC cannot find the library file after specifying the link library path
Subclass hides the function with the same name of the parent class
Get the executable path through the process PID (queryfullprocessimagename)
潘多拉 IOT 开发板学习(HAL 库)—— 实验5 外部中断实验(学习笔记)
Visual host system design and development (Halcon WinForm)
“用Android复刻Apple产品UI”(3)—优雅的数据统计图表
Baidu AI Cloud helps Shizuishan upgrade the smart health care model of "Internet + elderly care services"
通过进程PID获取可执行文件路径(QueryFullProcessImageName)
【Proteus仿真】8×8LED点阵屏仿电梯数字滚动显示
Microservices - load balancing ribbon
几种常见IO模型的原理
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock