Java Study

来源:互联网 发布:女生java发展方向 编辑:程序博客网 时间:2024/06/06 04:37

Java String summary

.

— subString(int startIndex , int endIndex);

if startIndex equals endIndex ,that return null;

the source code

      int subLen = endIndex - beginIndex;        if (subLen < 0) {            throw new StringIndexOutOfBoundsException(subLen);        }        return ((beginIndex == 0) && (endIndex == value.length)) ? this                : new String(value, beginIndex, subLen);

—String’s mothod mostly will new a String Object. So, use the “==” is terrible!

0 0
原创粉丝点击