Compiler

  • The compiler class supports the creation of java environment which compiles the java byte code in to executable code rather than interrupted.

Runnable

  • The Runnable interface must be implemented by any class that will initiate a separate thread of execution.
  • It defines one abstract method, called run( ), which is the entry point to the thread.

Thread

  • It creates a new thread of execution by implementing the Runnable interface.
  • It defines several constructors which takes the object reference for the Runnable interface as a argument.
  • It defines several methods like setPriority(int priority), setName(String threadName) which are the final methods with no return type.
  • getName() and getPriority() are the methods which returns the name and priority of thread respectively.
  • isAlive() is a method which returns the boolean value as thread is alive or not.
  • start() is the method which starts the execution of thread.
  • run() is the method which begins the execution of thread.

ThreadGroup

  • It creates the group of threads.
  • It defines two constructors as follows.

    ThreadGroup(String groupName)

ThreadGroup(ThreadGroup parentOb, String groupName)

groupName specifies the name of the thread group.

parentOb specifies the parent object.

ThreadLocal and InheritableThreadLocal

Java defines two additional thread-related classes in java.lang:

  • ThreadLocal Used to create thread local variables where each thread have its own copy of a thread local variable.
  • InheritableThreadLocal Creates thread local variables that may be inherited.

results matching ""

    No results matching ""