转载于 : http://www.verejava.com/?id=16992940862472

package com.join;


import java.util.*;

public class TestJoin {

	public static void main(String[] args) {
		View view = new View();

	}
}

class View {
	
	private String[] listView;

	public View() {
		Thread t = new Thread(new DownloadThread());
		t.start();

		try {
			t.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		for (String str : listView) {
			System.out.println(str);
		}
	}

	public String[] getListView() {
		return listView;
	}

	class DownloadThread implements Runnable {

		@Override
		public void run() {
			try {
				String[] countrys = { "北京", "上海", "天津", "重庆", "广州", "深圳", "武汉" };
				listView = new String[countrys.length];

				for (int i = 0; i < countrys.length; i++) {
					listView[i] = countrys[i];
					Thread.sleep(1000);
				}
			} catch (Exception e) {
				e.printStackTrace();
			}

		}

	}

}


转载于 : http://www.verejava.com/?id=16992940862472