zoukankan      html  css  js  c++  java
  • 模拟看病

    package day01;
    
    public class VIPThread implements Runnable{
        
    
        @Override
        public void run() {
            for(int i = 0;i<10;i++) {
                String name = Thread.currentThread().getName();
                System.out.println(name+(i+1)+"正在看病");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            // TODO Auto-generated method stub
            
        }
    
    }
    package day01;
    
    public class Main {
        public static void main(String[] args)  {
            VIPThread vipThread = new VIPThread();
            Thread vip = new Thread(vipThread,"VIP");
            vip.setPriority(10);
            vip.start();
            for(int i=0;i<50;i++) {
                if(i==10) {
                    try {
                        vip.join();
                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                String name = Thread.currentThread().getName();
                name= "普通患者";
                System.out.println(name+(i+1)+"正在看病");
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            
            
        }
    
    }

  • 相关阅读:
    cocos2d翻牌效果实现
    ShareSDK
    cocos2diphone版本选择
    UITextView设置透明背景
    iOS常用第三方类库
    CCMenu布局
    macosx下安装mysql
    mac截图
    iPhone对OpenGL ES的支持
    cocos2d下action和线程
  • 原文地址:https://www.cnblogs.com/hxtzzz/p/11302961.html
Copyright © 2011-2022 走看看