Here I was training to my OCP and test some String behaviors.
And when i get this:
System.out.println("a".substring(0) == "a".substring(0)); // true
System.out.println("a".substring(0) == "aa".substring(1)); // false
Some doubts came to me. I know what that method returns is:
return (beginIndex == 0) ? this : new String(value, beginIndex, subLen);
But, theres a conceptual error on this compiler rules or thats all ok?