値の表示 Java

概要

String型変数を宣言して内容を初期化し、標準出力へ出力する。

public class StringTest {
	public static void main(String[] args) {

		String country = "Japan";
		String zip_code = "100-0000";
		String State = "Tokyo";
		String city = "新宿区";
		String street = "歌舞伎町";
		String number = "1丁目1番1号";
		String building = "歌舞伎町ビル";
		String address = country + " " + zip_code + " " + State + " " + city
				+ " " + street + " " + number + " " + building;

		System.out.println(country);
		System.out.println(zip_code);
		System.out.println(State);
		System.out.println(city);
		System.out.println(street);
		System.out.println(number);
		System.out.println(building);
		System.out.println(address);
	}
}

実行結果

Japan
100-0000
Tokyo
新宿区
歌舞伎町
1丁目1番1号
歌舞伎町ビル
Japan 100-0000 Tokyo 新宿区 歌舞伎町 1丁目1番1号 歌舞伎町ビル