Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb1df03

Browse filesBrowse files
committed
[docs improve] 新增基本数据类型的取值范围
1 parent 63b5c8f commit eb1df03
Copy full SHA for eb1df03

File tree

Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Collapse file

‎docs/java/basis/java-basic-questions-01.md‎

Copy file name to clipboardExpand all lines: docs/java/basis/java-basic-questions-01.md
+10-10Lines changed: 10 additions & 10 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -640,16 +640,16 @@ Java 中有 8 种基本数据类型,分别为:
640640
641641
8 种基本数据类型的默认值以及所占空间的大小如下:
642642
643-
| 基本类型 | 位数 | 字节 | 默认值 |
644-
| :-------- | :--- | :--- | :------ |
645-
| `byte` | 8 | 1 | 0 |
646-
| `short` | 16 | 2 | 0 |
647-
| `int` | 32 | 4 | 0 |
648-
| `long` | 64 | 8 | 0L |
649-
| `char` | 16 | 2 | 'u0000' |
650-
| `float` | 32 | 4 | 0f |
651-
| `double` | 64 | 8 | 0d |
652-
| `boolean` | 1 | | false |
643+
| 基本类型 | 位数 | 字节 | 默认值 | 取值范围 |
644+
| :-------- | :--- | :--- | :------ | ------------------------------------------ |
645+
| `byte` | 8 | 1 | 0 | -128 ~ 127 |
646+
| `short` | 16 | 2 | 0 | -32768 ~ 32767 |
647+
| `int` | 32 | 4 | 0 | -2147483648 ~ 2147483647 |
648+
| `long` | 64 | 8 | 0L | -9223372036854775808 ~ 9223372036854775807 |
649+
| `char` | 16 | 2 | 'u0000' | 0 ~ 65535 |
650+
| `float` | 32 | 4 | 0f | 1.4E-45 ~ 3.4028235E38 |
651+
| `double` | 64 | 8 | 0d | 4.9E-324 ~ 1.7976931348623157E308 |
652+
| `boolean` | 1 | | false | truefalse |
653653
654654
对于 `boolean`,官方文档未明确定义,它依赖于 JVM 厂商的具体实现。逻辑上理解是占用 1 位,但是实际中会考虑计算机高效存储因素。
655655

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.