Java concatenate strings vs static strings -
i try better understanding of strings. making program requires lot of strings. however, lot of strings very similar , merely require different word @ end of string.
e.g.
string 1 = "i went store , bought milk" string 2 = "i went store , bought eggs" string 3 = "i went store , bought cheese"
so question is, approach best suited take when dealing strings? concatenating 2 strings have benefits on having static strings in, example, performance or memory management?
e.g.
string 1 = "i went store , bought " string 2 = "milk" string 3 = "cheese" string 4 = 1 + 2 string 5 = 1 + 3
i trying figure out optimal way of dealing these strings. (if helps put number of strings using, have 50 number surplus huge amount)
as spooky has said main concern code readability. unless working on program phone not need manage resources. being said, doesn't matter whether create lot of strings
stand alone or concatenate base string
small piece varies. won't notice better performance either way.
Comments
Post a Comment