同意!给你源码: * @author unascribed * @version 1.155, 06/26/04 * @see java.lang.Runnable * @see java.lang.Runtime#exit(int) * @see java.lang.Thread#run() * @see java.lang.Thread#stop() * @since JDK1.0 */ public class Thread implements Runnable { /* Make sure registerNatives is the first thing <clinit> does. */ private static native void registerNatives(); static { registerNatives(); } private char name[]; private int priority; private Thread threadQ; private long eetop; private boolean started; // true iff this thread has been started /* Whether or not to single_step this thread. */ private boolean single_step; /* Whether or not the thread is a daemon thread. */ private boolean daemon = false; /* Whether or not this thread was asked to exit before it runs.*/ private boolean stillborn = false; /* What will be run. */ private Runnable target; /* The group of this thread */ private ThreadGroup group; /* The context ClassLoader for this thread */ private ClassLoader contextClassLoader; /* The inherited AccessControlContext of this thread */ private AccessControlContext inheritedAccessControlContext; /* For autonumbering anonymous threads. */ private static int threadInitNumber; private static synchronized int nextThreadNum() { return threadInitNumber++; } /* ThreadLocal values pertaining to this thread. This map is maintained * by the ThreadLocal class. */ ThreadLocal.ThreadLocalMap threadLocals = null; /* * InheritableThreadLocal values pertaining to this thread. This map is * maintained by the InheritableThreadLocal class. */ ThreadLocal.ThreadLocalMap inheritableThreadLocals = null; /* * The requested stack size for this thread, or 0 if the creator did * not specify a stack size. It is up to the VM to do whatever it * likes with this number; some VMs will ignore it. */ private long stackSize; /* * Thread ID */ private long tid; /* For generating thread ID */ private static long threadSeqNumber; /* Java thread status for tools, * initialized to indicate thread 'not yet started' */ private int threadStatus = 0; private static synchronized long nextThreadID() { return ++threadSeqNumber; } /* The object in which this thread is blocked in an interruptible I/O * operation, if any. The blocker's interrupt method should be invoked * after setting this thread's interrupt status. */ private volatile Interruptible blocker; private Object blockerLock = new Object(); /* Set the blocker field; invoked via reflection magic from java.nio code */ private void blockedOn(Interruptible b) { synchronized (blockerLock) { blocker = b; } } 还有很多
类只能继随一个类,但能实现多个接口!
* @author unascribed
* @version 1.155, 06/26/04
* @see java.lang.Runnable
* @see java.lang.Runtime#exit(int)
* @see java.lang.Thread#run()
* @see java.lang.Thread#stop()
* @since JDK1.0
*/
public
class Thread implements Runnable {
/* Make sure registerNatives is the first thing <clinit> does. */
private static native void registerNatives();
static {
registerNatives();
} private char name[];
private int priority;
private Thread threadQ;
private long eetop;
private boolean started; // true iff this thread has been started /* Whether or not to single_step this thread. */
private boolean single_step; /* Whether or not the thread is a daemon thread. */
private boolean daemon = false; /* Whether or not this thread was asked to exit before it runs.*/
private boolean stillborn = false; /* What will be run. */
private Runnable target; /* The group of this thread */
private ThreadGroup group; /* The context ClassLoader for this thread */
private ClassLoader contextClassLoader; /* The inherited AccessControlContext of this thread */
private AccessControlContext inheritedAccessControlContext; /* For autonumbering anonymous threads. */
private static int threadInitNumber;
private static synchronized int nextThreadNum() {
return threadInitNumber++;
} /* ThreadLocal values pertaining to this thread. This map is maintained
* by the ThreadLocal class. */
ThreadLocal.ThreadLocalMap threadLocals = null; /*
* InheritableThreadLocal values pertaining to this thread. This map is
* maintained by the InheritableThreadLocal class.
*/
ThreadLocal.ThreadLocalMap inheritableThreadLocals = null; /*
* The requested stack size for this thread, or 0 if the creator did
* not specify a stack size. It is up to the VM to do whatever it
* likes with this number; some VMs will ignore it.
*/
private long stackSize; /*
* Thread ID
*/
private long tid; /* For generating thread ID */
private static long threadSeqNumber; /* Java thread status for tools,
* initialized to indicate thread 'not yet started'
*/
private int threadStatus = 0;
private static synchronized long nextThreadID() {
return ++threadSeqNumber;
} /* The object in which this thread is blocked in an interruptible I/O
* operation, if any. The blocker's interrupt method should be invoked
* after setting this thread's interrupt status.
*/
private volatile Interruptible blocker;
private Object blockerLock = new Object(); /* Set the blocker field; invoked via reflection magic from java.nio code
*/
private void blockedOn(Interruptible b) {
synchronized (blockerLock) {
blocker = b;
}
}
还有很多
从@override可以看的出来。