
In this post, we will learn about Datatypes in java and it’s default value
Below are the list of primitive data types
- int (int i=1;)
- float (float f=0.10;)
- char (char c =’d’;)
- byte (byte by=1;)
- short (short s =0;)
- long (long l=3L;)
- double (double d=10;)
- boolean (boolean b=false;)
| Datatype | DefaultValue |
|---|---|
| int | 0 |
| float | 0.0f |
| char | ‘\u0000’ |
| byte | 0 |
| short | 0 |
| long | 0L |
| double | 0.0d |
| boolean | false |
Reference
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html