1 class A{
2 int i;
3 int j;
4 }
5
6 clsaa demo{
7 public static void main(String[] args){
8 A aa = new A();
9
10 A aa; //用数据类型+变量名,aa本身的内存是在栈中静态分配的
11 aa = new A(); //在堆中动态分配一块区域,被当做了A对象
12 //堆中内存的地址赋给了aa
13 //aa指向堆中的内存,aa代表了堆中的内存
14 //aa.i 代表:aa这个静态指针变量所指向的动态内存中的A对象的i这个成员
15 }
16 }
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有