Data Types in Java
In java, there are two types of data types
|
| Data Type | Default Value | Default size |
|---|---|---|
| boolean | false | 1 bit |
| char | '\u0000' | 2 byte |
| byte | 0 | 1 byte |
| short | 0 | 2 byte |
| int | 0 | 4 byte |
| long | 0L | 8 byte |
| float | 0.0f | 4 byte |
| double | 0.0d | 8 byte |
Why char uses 2 byte in java and what is \u0000 ?
| because java uses unicode system rather than ASCII code system. \u0000 is the lowest range of unicode system.To get detail about Unicode see below. |
No comments:
Post a Comment