Advertisement
FacundoCruz

RegionCritica

May 12th, 2022
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public class Deposito extends Thread{
  2.  
  3. private RegionCritica cuenta;
  4.  
  5. public Deposito(RegionCritica cont) {
  6.  
  7. cuenta = cont;
  8.  
  9. }
  10.  
  11. @Override
  12. public void run() {
  13.  
  14. try {
  15.  
  16. sleep(50);
  17.  
  18. double i = cuenta.GetContador();
  19.  
  20. cuenta.setContador(i+300);
  21.  
  22. System.out.println("--Deposito Exitoso--");
  23.  
  24. System.out.println("Saldo actual : "+cuenta.GetContador());
  25.  
  26. } catch (InterruptedException e) {
  27. System.out.println("ERROR DEPOSITO...");
  28. }
  29. }
  30. }
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement