public class StringTest{
	static public void main(String arg[]){
		String one=new String("One ");//String one="One ";と簡略化できる
		String two=new String("Two ");
		String three=new String("Three");
		String s,t;
		//
		System.out.println("one="+one);
		System.out.println("two="+two);
		System.out.println("three="+tree);
		s=one+two+three;//文字列の足し算は文字列の結合
		System.out.println("s=one+two+three;//文字列の足し算は文字列の結合");
		System.out.println("s="+s);
		System.out.println("文字数s.length()は"+s.length());//文字列の長さはlength()関数でget
		t=s;//tにもsと同じ場所を代入
		System.out.println("t=s;を実行するとt,sは同じ実体を参照する");
		System.out.println("s="+s);
		System.out.println("t="+t);
		t=t+" Four";//文字列の足し算はその文字を長くするのではなく別に作る
		System.out.println("t=t+\" Four\";//文字列の足し算では別に実体が作られる");
		System.out.println("s="+s);
		System.out.println("t="+t);
		System.out.println("t,sは異なる実体を参照している");
	}
}
/*
D:\WWW\edu\gengo2j\page2>java StringTest
one=One
two=Two
tree=Three
s=one+two+three;//文字列の足し算は文字列の結合
s=One Two Three
文字数s.length()は12
t=s;を実行するとt,sは同じ実体を参照する
s=One Two Three
t=One Two Three
t=t+" Four";//文字列の足し算では別に実体が作られる
s=One Two Three
t=One Two Three Four
t,sは異なる実体を参照している
*/