Alejandro_S_Mercado

Untitled

Sep 24th, 2025
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. public class Pasillo extends Thread {
  2.    
  3.    
  4. public void entry(int idPersona) {
  5.     try {
  6. System.out.println("Persona " + idPersona + " está entrando por el pasillo...");
  7.     Thread.sleep(50);
  8.     System.out.println("Persona " + idPersona + " cruzó el pasillo...");  
  9.    
  10.     }catch(InterruptedException e) {
  11.         e.printStackTrace();
  12.     }
  13.     }
  14.  
  15. public void exit(int idPersona) {
  16.     try {
  17.         System.out.println("Persona " + idPersona + " está saliendo por el pasillo...");
  18.     Thread.sleep(50);
  19.     System.out.println("Persona " + idPersona + " terminó de salir.");
  20.     }catch(InterruptedException e) {
  21.         e.printStackTrace();
  22.     }
  23. }
  24.  
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment