2013年10月8日

java种StringBuilder

摘要: package frank;import java.lang.*;public class App{ public static void main(String[] args) throws Exception { StringBuilder sb = new StringBuilder(); System.out.println(sb.capacity()); for(int i = 0;i<20;i++) { sb.append(i); } sb.insert(0,"h");//插入 sb.replace(5,6,".");//替换 sb.d 阅读全文

posted @ 2013-10-08 22:24 wp456 阅读(229) 评论(0) 推荐(0)

java中String类方法介绍及使用

摘要: package frank;import java.lang.*;import java.nio.charset.Charset;/** * String类的使用 * */public class App{ public static void main(String[] args) throws Exception { byte[] b1 = new byte[]{1}; String s1 = new String(b1,Charset.defaultCharset());//得到使用指定字符集解码后的新String System.out.println(s1); System.o... 阅读全文

posted @ 2013-10-08 17:04 wp456 阅读(241) 评论(0) 推荐(0)

hashCode和System.identityHashCode值

摘要: package frank;import java.lang.*;/** * * */public class App{ public static void main(String[] args) throws Exception { String s1 = new String("1"); String s2 = new String("1"); System.out.println(s1.hashCode()+"-----"+s2.hashCode());//字符序列化值一样,因为他们的实际值一样 System.out.prin 阅读全文

posted @ 2013-10-08 09:13 wp456 阅读(210) 评论(0) 推荐(0)

导航