Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您能否让我知道Stringpool实现背后的确切类,因为我想知道它是如何实现FlyWeightDesign 模式的
字符串池未在 Java 源代码中实现。您不会在 Java 中找到源代码。检查 java.lang.String.intern() 本机方法。我认为大多数 JVM 实现都有用 C++ 实现的字符串池。我还记得在某处读到它也可以通过其他方式完成。