Regarding Java String Constant Pool

后端 未结 3 710
长情又很酷
长情又很酷 2020-12-11 03:07

This is regarding the Java String Constant Pool. In one of my Programs i am decrypting the password for the database and storing it in a String. I heard that the Java String

3条回答
  •  不知归路
    2020-12-11 04:02

    This only applies to String literals and Strings that you have called the intern() method on. Think about it: if it applied to all strings then you would quickly run out of memory in e.g. a servlet application that handles request parameters with different (String) values.

提交回复
热议问题