Home > 类库下载 > java类库 > [JAVA Concurrent Programming Practice] Lock Sequence Deadlock

[JAVA Concurrent Programming Practice] Lock Sequence Deadlock

高洛峰
Release: 2016-11-17 13:39:15
Original
1838 people have browsed it

package cn.study.concurrency.ch10;

public class Account {
    private String staffAccount;    //账号
    private String passWord;    //密码
    private int balance; //账户余额
    
    public Account(int money) {
        this.balance = money;
    }
    
    public String getStaffAccount() {
        return staffAccount;
    }
    public void setStaffAccount(String staffAccount) {
        this.staffAccount = staffAccount;
    }
    public String getPassWord() {
        return passWord;
    }
    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }
    
    public void debit(int amount)
    {
        System.out.println("转出账户:" + amount);
    }
    
    public void credit(int amount)
    {
        System.out.println("转入账户:" + amount);
    }
    public int getBalance() {
        return balance;
    }
    public void setBalance(int balance) {
        this.balance = balance;
    }
    
}
Copy after login
rrree

Test results:

[JAVA Concurrent Programming Practice] Lock Sequence Deadlock

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template