click below
click below
Normal Size Small Size show me how
OCPJP710.1
Cert Obj Defining, Instantiating, and Starting Threads
[10.1.1] Constructors for threads | Thread(),■ Thread(Runnable target),■ Thread(Runnable target, String name),■ Thread(String name) |
[10.1.2] Daemon | Daemon threads are meant to perform supporting tasks that make sense only if normal threads are running.For eg, GC thread is useful only if some user thread is running. |
[10.1.3] Non daemon threads required otherwise daemon threads have no value | So the program should end when all the non-daemon threads end. Can make any Thread (if you have permission) a daemon thread by calling setDaemon(true) before starting that thread.You can stop any thread. |
[10.1.4] methods that act on Thread | t.sleep(); or t.yield(); // both are static methods |
[10.1.5] |