Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
13 Threads 13.2 Einen Thread implementieren 13-4 Threads/JaNein/Runnable/RandomRun.java
 

Summary: 13 Threads 13.2 Einen Thread implementieren 13-4
Threads/JaNein/Runnable/RandomRun.java
6 class RandomRun implements Runnable
7 {
8 private String meinName;
11 public RandomRun(String str) { meinName = str; }
14 public String getName() { return meinName; }
17 public void run()
18 {
19 for (int i = 0; i < 10; i++)
20 {
21 System.out.println(i + " mal " + getName());
22 try
23 {
24 Thread.sleep((int)(Math.random() * 1000));
25 }
26 catch (InterruptedException e) {}
27 }
28 System.out.println("Die Antwort lautet: " + getName());
29 }

  

Source: Arndt, Holger - Fachgruppe Mathematik, Fachbereich Mathematik-Naturwissenschaften, Bergische Universitšt Wuppertal

 

Collections: Computer Technologies and Information Sciences