CAPITOLO 7 - PowerPoint PPT Presentation

About This Presentation
Title:

CAPITOLO 7

Description:

CAPITOLO 7 JAVA: MULTITHREADING E PROGRAMMAZIONE CONCORRENTE PROGRAMMAZIONE MULTITHREAD public class Multithread { public static void main (String args ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 3
Provided by: GFP9
Category:

less

Transcript and Presenter's Notes

Title: CAPITOLO 7


1
CAPITOLO 7
  • JAVA MULTITHREADING E PROGRAMMAZIONE
    CONCORRENTE

2
PROGRAMMAZIONE MULTITHREAD
  • public class Multithread
  • public static void main (String args)
  • TestThrd t1, t2, t3
  • t1 new TestThrd("Din"
    (int)(Math.random())2000) t2 new
    TestThrd("Don" (int)(Math.random())2000)
    t3 new TestThrd("Dan" (int)(Math.random())2000
    )
  • t1.start() t2.start() t3.start()
  • class TestThrd extends Thread
  • private String whoami private int delay
  • public TestThrd(String s, int d)
  • whoami s delay d
  • public void run() try sleep(delay)
  • catch (InterruptedException e)
  • System.out.println(whoami)
Write a Comment
User Comments (0)
About PowerShow.com