Regarding Java String Constant Pool

后端 未结 3 711
长情又很酷
长情又很酷 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 03:39

    Dude, use a string buffer for getting the password and doing your (presumably) string-type operations on.

    StringBuffer stores strings as char[], which can be deleted. Or overridden or what have you. Say StringBuffer.delete(0,StringBuffer.length());

    Or just get the db password as a char[] and work directly on that - but i think the StringBuffer way (assuming you've made all your code using String methods) will be an easier leap.

提交回复
热议问题