Quantcast
Channel: JavaPins - Stories tagged with immutable
Viewing all articles
Browse latest Browse all 8

Why String has been made immutable in Java? | Geek Explains: Java, J2EE, Oracle, Puzzles, and Problem Solving!

$
0
0
Why String has been made immutable in Java? Though, performance is also a reason (assuming you are already aware of the internal String pool maintained for making sure that the same String object is used more than once without having to create/re-claim it those many times), but the main reason why String has been made immutable in Java is 'Security'. Surprised? Let's understand why. Suppose you need to open a secure file which requires the users to authenticate themselves. Let's say there are two u...
Pin it

Viewing all articles
Browse latest Browse all 8

Trending Articles