Skip to main content

All Questions

2 votes
3 answers
611 views

Why do most language's definition of substring allow substring("abc", 3) => ""

I've seen most languages have it be the case for their substring method that using the length of a given string in the method as the start index will give you an empty string. It is most definitely ...
edaniels's user avatar
  • 131
86 votes
11 answers
34k views

Why is String immutable in Java?

I couldn't understand the reason of it. I always use String class like other developers, but when I modify the value of it, new instance of String created. What might be the reason of immutability ...
yfklon's user avatar
  • 1,772