Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Prof. Mark Handley 13-Okt-03
Dept. of Computer Science
University College London
Pearson Building Room 113
3C03 Concurrency
Lab Session 2 - Work Sheet
This lab session will give you practical experience on how to implement Java Threads.
Java source files end with the file name extension .java. The java compiler that creates machine
independent bytecode is given a Java source file as a command line argument. It is invoked using
javac .
For the exercises in this lab you want to copy the Java and HTML source files from
http://nrg.cs.ucl.ac.uk/mjh/3c03/ThreadDemo into an empty directory of yours.  Be
sure to copy the concurrency and concurrency/display subdirectories.
To compile the demo, run
Javac concurrency/ThreadDemo.java
To run the demo, load ThreadDemo.html in your web browser.
Note that some web browsers will cache the current version of a java program, so it may be necessary
to clear the cache or restart the browser to view the applet after you modify and recompile it.
Exercise 1:
We want to modify the behaviour of ThreadDemo such that there are three concurrent rotations. Define
this modified behaviour in FSP
Exercise 2:
Modify the Java source of ThreadDemo that you downloaded from my web page so that it implements
this modified behaviour.
Exercise 3:
The DisplayThread class in the ThreadDemo applet and your modified version implement threads
by inheriting from Thread. Implement DisplayThread without this inheritance relationship.