11系统默认值

就是在堆中只是申明了没有初始化,所以系统会自动的给变量初始化

成员变量存放在堆中,静态成员变量存放在方法区的静态区,都是可以赋予系统的默认值

byte-short-int ->0

char ->u0000   u是指定的一种码表 --UTF-16码表

long ->0L

float->0.0F

double ->0.0

boolean ->false

引用类型->null

public class HellowWorld {
   
public static void main(String[] argv ) {
int[]arr=new int[2];
System.out.println(arr[1]);   //0
int[] arr2= {1,2,3};
arr2[1]=5;
System.out.println(arr2[1]);   //5
    
}//endmain
}//endclass

这行代码的内存图

原文地址:https://www.cnblogs.com/xuwangqi/p/11031374.html