24 lines
639 B
Java
24 lines
639 B
Java
package thead.start.thread_7;
|
|
|
|
public class ThreadA extends Thread {
|
|
|
|
public Service service;
|
|
|
|
/**
|
|
* Allocates a new {@code Thread} object. This constructor has the same
|
|
* effect as {@linkplain #Thread(ThreadGroup, Runnable, String) Thread}
|
|
* {@code (null, null, gname)}, where {@code gname} is a newly generated
|
|
* name. Automatically generated names are of the form
|
|
* {@code "Thread-"+}<i>n</i>, where <i>n</i> is an integer.
|
|
*/
|
|
public ThreadA(Service service) {
|
|
super.run();
|
|
this.service = service;
|
|
}
|
|
|
|
@Override
|
|
public void run() {
|
|
service.methodA();
|
|
}
|
|
}
|