Test the default values of 8 basic data types through a piece of code
package dieerge;public class Ceshi {int a;double b;boolean c;char d;float f;byte e;long h;short j;public static void main(String args[]){Ceshi a=new Ceshi();System.out.println("The default value of integer type is: "+aa);System.out.println("The default value of double precision floating point type is: "+ab);System.out.println("The default value of Boolean type is: "+ac);System.out.println("The default value of character type is: "+ad );System.out.println("byte's default value is: "+ae);System.out.println("The default value of single-precision floating-point type is: "+af);System.out.println("The default value of short integer type is: "+aj);System.out.println("The default value of long integer type is: "+ah);}}The operation results are as follows:
The default value of integer type is: 0
The default value of double precision floating point type is: 0.0
The default value of the boolean type is: false
The default value of character type is:
The following conclusions are drawn:
Basic type default value
byte
Short
int
long
0L
float
0.0f
double
0.0d
char
'/u0000'
boolean
false
The above is the default values of eight basic data types in Java introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!