package com.itjob.javabasic;

public class StringTest {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String xingming = "xiexingxing";
		String xing = "xie";
		String ming = "xingxing";

		System.out.println(xingming == "xie" + "xingxing");
		System.out.println(xingming == xing + ming);
		
		String tempstr = "abcdefghijklmnopqrstuvwxyz";
		int times = 5000;
		long lstart1 = System.currentTimeMillis();
		String str = "";
		for (int i = 0; i < times; i++) {
			str += tempstr;
		}
		long lend1 = System.currentTimeMillis();
		long time = (lend1 - lstart1);
		System.out.println(time);
		
		// String tempstr = "abcdefghijklmnopqrstuvwxyz";
		// int times = 5000;
		long lstart2 = System.currentTimeMillis();
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < times; i++) {
			sb.append(tempstr);
		}
		long lend2 = System.currentTimeMillis();
		long time2 = (lend2 - lstart2);
		System.out.println(time2);

	}
}
