Multithreading

From , 3 Years ago, written in Java, viewed 95 times.
URL https://pastebin.vip/view/540ae6b0
  1. public class Account {
  2.  
  3.         private int balance;
  4.         public int getBalance() {
  5.                 return balance;
  6.         }
  7.         public void setBalance(int balance) {
  8.                 this.balance = balance;
  9.         }
  10.         public Account(int balance){
  11.         this.setBalance(balance);
  12.         }
  13.        
  14.         public int withDraw(int drawMount){
  15.                 if(drawMount<0){
  16.                         System.out.println("取款额为负数");
  17.                         return 0;
  18.                 }
  19.                 else if(balance<drawMount){
  20.                         System.out.println("余额不足");
  21.                     return 0;
  22.                 }else{
  23.                         balance=balance-drawMount;
  24.                         return drawMount;
  25.                 }
  26.         }
  27. }
  28.  

Reply to "Multithreading"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website