区别
来源:互联网 发布:ubuntu 16.04 编辑:程序博客网 时间:2024/04/29 02:04
数组中int[] a={};和int[] a=null;两者之间是有区别的。
int[] a={};{}中是有东西的,它在堆内存中开辟了空间,只是没有存东西。
int[] a=null;是在栈内存中开辟了4个字节,这块内存的名字叫a。
另外两者的输出结果也不同,前8者输出的是首地址,后者输出的是null值。
class yanzheng{
public static void main(String[] args){
int[] a=null;
System.out.println(a);
}
}
class yanzheng{
public static void main(String[] args){
int[] a={};
System.out.println(a);
}
}
阅读全文
0 0
- 区别
- 区别...
- 区别
- 区别
- 区别
- 区别
- 区别
- 区别
- 区别
- 区别
- ./ ../ /区别
- 区别:%{} 、 ${} 、 #
- $()、$(())、${}、(())区别
- 区别
- 区别区别更健康
- &&与&区别
- ${....}和区别
- ...与[]区别
- 项目中使用Bootstrap以及基于bootstrap的 Bootgrid
- fatal: unable to access 'url': Failed connect to githup.com:443; No error
- 523. Continuous Subarray Sum
- Leetcode 561.Array Partition I
- IAR STM32 函数和变量的绝对地址定位
- 区别
- webstorm常用快捷键
- 湖南省第十二届大学生计算机程序设计竞赛 Parenthesis
- java字符串基础
- 状态模式——详解红绿灯问题
- POJ 1015--Jury Compromise
- 关注国情民情,从身边做起
- 486. Predict the Winner
- 人工智能之父、Lisp语言发明者John McCarthy