11系统默认值

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

byte-short-int ->0

char ->\u0000   \u是按照编码

long ->0L

float->0.0F

double ->0.0

boolean ->false

引用类型->null

public class HellowWorld {
    //判断一个32位的整数的二进制有几个1
public static void main(String[] argv ) {
int[]arr=new int[2];
System.out.println(arr[1]);
int[] arr2= {1,2,3};
arr2[1]=5;
System.out.println(arr2[1]);
    
}//endmain
}//endclass

这行代码的内存图

猜你喜欢

转载自www.cnblogs.com/xuwangqi/p/11031374.html
今日推荐