📄 thread1.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 + -