⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread1.java

📁 a simple thread program to print numbers it can be synchronized with operating system tickms by inc
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package ashish;public class Thread1  {     Thread t1=new Thread();    Thread t2= new Thread();    int count=0;        //    public static void main(String arg[]){//        isEmpty();//    }public void isEmpty1()    {    t1.start(); //starts the thread}    public void isEmpty()    {        try         {            t1.suspend(); //suspends the thread            Add();        }        catch(Exception ex)        {            ex.printStackTrace();        }    }    public void Add()    {        try        {             if(count==5)            {                                System.exit(0);            }            count++;            System.out.println(count);            t1.resume();            isEmpty();                    }        catch (Exception ex)        {            ex.printStackTrace();        }    }    public void run()    {           }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -