多线程test

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

/**
 * Created by zhengyizhan on 2019/6/21.
 */
public class test {
	private static int i=0;
	public static void main(String[] args) throws InterruptedException {
		xiancheng();
		while (true){
			Thread.sleep(1000);
			System.out.println("线程结束");
			break;
		}
	}

	public static void xiancheng(){
		String msg="----";
		new Thread(){
			public void run(){
				System.out.println(msg);
				for(i=0;i<9999;i++){
					System.out.println(i+msg);
				}
			}
		}.start();
		new Thread(){
			public void run(){
				for(i=0;i<9999;i++){
					System.out.println("xixi");
				}
			}
		}.start();
	}

}

  

posted @ 2019-06-24 17:50  1456710017  阅读(151)  评论(0编辑  收藏  举报