1 / 2

CAPITOLO 7

CAPITOLO 7. JAVA: MULTITHREADING E PROGRAMMAZIONE CONCORRENTE. PROGRAMMAZIONE MULTITHREAD. public class Multithread { public static void main (String args[]) { TestThrd t1, t2, t3;

gary
Download Presentation

CAPITOLO 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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) ; } }

More Related