From fea0e80fc5a3e21c48002154dc6a363e02c9684d Mon Sep 17 00:00:00 2001 From: Wonder Date: Tue, 21 Oct 2025 19:37:23 +0800 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=93=9DDocs:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=85=B3=E4=BA=8E=E5=B8=B8=E9=87=8F=E5=AE=9A=E4=B9=89=E7=9A=84?= =?UTF-8?q?=E8=A7=A3=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3129605..c23f567 100644 --- a/README.md +++ b/README.md @@ -87,4 +87,14 @@ CREATE UNIQUE INDEX idx_userId_blogId ON thumb (userId, blogId); - 方法 B 优于方法 A - 方法 A 需要调用 `toString()` 方法,有额外开销 - 方法 B 直接调用 `longValue()` 方法,`JVM` 优化 - - 方法 B 抛出的异常容易定位问题。 \ No newline at end of file + - 方法 B 抛出的异常容易定位问题。 + +--- + +> Q7. _常量_ | 定义常量的最佳方式? + +- > "Do not use interfaces for constants. Interfaces are for defining types and behaviors, not for storing data." + > + > — _Effective Java Item 18_ +- 不建议选择 `Interface` 定义常量 +- 而应该选用 `Class - public static final String` 定义常量 \ No newline at end of file