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

📄 deadlock.java

📁 《java事件处理指南》一书的代码,好东西
💻 JAVA
字号:
import java.awt.event.*;import java.awt.*;public class Deadlock{   Account acct1, acct2;   public Deadlock(int amt1, int amt2)   {/*  Two Account objects are created   */      acct1 = new Account(amt1, "account one");      acct2 = new Account(amt2, "account two");/*  Two transactions are executed as separate threads.  The first  *//*  transfers money from Account acct1 to Account acct2.  The      *//*  second transaction transfers money from acct2 to acct1.        */      Thread thread1 = new Thread(new TransferAtoB(acct1, acct2, 50));      thread1.setName("Thread 1");      thread1.start();      System.out.println(thread1.getName()+" started");      Thread thread2 = new Thread(new TransferAtoB(acct2, acct1, 75));      thread2.setName("Thread 2");      thread2.start();      System.out.println(thread2.getName()+" started");   }   public static void main(String args[])   {      Deadlock demo = new Deadlock(100, 200);   }}

⌨️ 快捷键说明

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