GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — toBeTopJavaer/basics/java-basic/string-append.md at master · yangjunhui710/toBeTopJavaer Expand file tree/ Copy pathstring-append.mdMore file actions 3 lines (2 loc) · 308 Bytes / Copy pathstring-append.mdFile metadata and controls3 lines (2 loc) · 308 Bytes 1 2 3 1. String s = "a" + "b",编译器会进行常量折叠(因为两个都是编译期常量,编译期可知),即变成 String s = "ab" 2. 对于能够进行优化的(String s = "a" + 变量 等)用 StringBuilder 的 append() 方法替代,最后调用 toString() 方法 (底层就是一个 new String()) |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |