1 package cn.nxl2018;
2 public class Test {
3 private boolean bool;
4 private byte bt;
5 private short st;
6 private char ch;
7 private int i;
8 private long l;
9 private float f;
10 private double d;
11 private String str;
12 public static void main(String[] args){
13 int j;
14 Test test=new Test();
15 System.out.println(test.bool);//默认值是false
16 System.out.println(test.bt);//默认值是0
17 System.out.println(test.st);//默认值是0
18 System.out.println(test.ch);//默认值是空字符('u0000')
19 System.out.println(test.i);//默认是0
20 System.out.println(test.l);//默认是0
21 System.out.println(test.f);//默认是0.0
22 System.out.println(test.d);//默认是0.0
23 System.out.println(test.str);//默认是null
24 //System.out.println(j);//The local variable j may not have been initialized(变量可能没有被初始化)
25 }
26 }
关联博客(SCDN):https://blog.csdn.net/m0_38022608/article/details/80209741