当前位置:网站首页>创建对象时JVM内存结构
创建对象时JVM内存结构
2022-06-27 19:21:00 【zhengmayusi】
文章目录
代码
- Student类:
public class Student {
int no;
String name;
int age;
boolean sex;
String address;
}
- StudentTest类:
public class StudentTest {
public static void main(String[] args) {
Student s1 = new Student();
Student s2 = new Student();
}
}
JVM中对应内存结构图
note:
- s1、s2是局部变量(在方法中创建的变量),局部变量存储在栈内存中
- 对象和引用的区别?
- 对象是通过new出来的,在堆内存中存储
- 引用是:但凡是变量,并且该变量中保存了内存地址,指向了堆内存当中的对象(此例中main方法中的变量s1、s2就是保存了对象Student在堆内存中的地址)
边栏推荐
- 释放开源数据库创新力量 | 【甘肃】openGauss Meetup圆满结束
- 白嫖红队goby&POC,叫你如何白嫖?
- "Good voice" has been singing for 10 years. How can the Chinese language in the starry sky sing well in HKEx?
- Ceph分布式存储
- Full record of 2022 open source moment at Huawei partners and Developers Conference
- 本周二晚19:00战码先锋第8期直播丨如何多方位参与OpenHarmony开源贡献
- 关于企业数字化的展望(38/100)
- Experiment of love number lesson | phase V - emotion judgment of commodity review based on machine learning method
- Prospects for enterprise digitalization (38/100)
- 分享下我是如何做笔记的
猜你喜欢
SQL Server for循环用法
KDD 2022 | 图“预训练、提示、微调”范式下的图神经网络泛化框架
Graduation design of police report convenience service platform based on wechat applet
Release of global Unicorn list in 2021: the full list of 301 Unicorn enterprises in China is coming!
mysql使用笔记一
How to participate in openharmony code contribution
Show the comprehensive strength of strong products, and make the first show of 2022 Lincoln aviator in Southwest China
Codeforces Round #723 (Div. 2)
今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献
How to do a good job of gateway high availability protection in the big promotion scenario
随机推荐
Codeforces Round #717 (Div. 2)
mime. Type file content
分享|智慧环保-生态文明信息化解决方案(附PDF)
OpenSSL 编程 一:基本概念
Codeforces Global Round 14
小王的面试训练任务
送你12个常用函数公式,用过的都说好
Navicat Premium连接问题--- Host ‘xxxxxxxx‘ is not allowed to connect to this MySQL server
Codeforces Round #721 (Div. 2)
Focus! Tips for installing fonts on domestic computers
CEPH distributed storage
Experience Navicat premium 16, unlimited reset, 14 day trial method (with source code)
Flood fighting and disaster relief, overcoming difficulties, and City United premium products rushed to the aid of Yingde to donate loving materials
非常全面的DolphinScheduler(海豚调度)安装使用文档
Leetcode 821. Minimum distance of characters (simple) - sequel
OpenSSL 编程 二:搭建 CA
Wechat applet based service management system for college party members' Home System applet graduation design, Party members, activists, learning, punch in, forum
SQL必需掌握的100个重要知识点:IN 操作符
Goldfish rhca memoirs: do447 managing projects and carrying out operations -- creating job templates and starting jobs
Codeforces Round #719 (Div. 3)