Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
public class Persona extends Thread { private int id; private Pasillo pasillo; private Random random; public Persona(int id,Pasillo pasillo) { this.id=id; this.pasillo=pasillo; this.random=new Random(); } public void run() { System.out.println("Persona " + id + " hace fila para entrar."); try { int timePermanency=random.nextInt(700-400)+400; synchronized(pasillo) { pasillo.entry(id); System.out.println("Persona " + id + " está dentro del Zoo por " + timePermanency + "ms."); Thread.sleep(timePermanency); System.out.println("Persona " + id + " hace fila para salir."); pasillo.exit(id); } System.out.println("Persona " + id + " ha salido del Zoo."); }catch(InterruptedException e) { e.printStackTrace(); } } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)