Monday, May 13, 2019

Thread Class In Java

public class Thread  
               extends Object 
                     implements Runnable

Constructors:
  • Thread(): Use to create a new Thread object
  • Thread(Runnable target): Use to create a new Thread object while inplements Runnable interface in class.
  • Thread(Runnable target, String name): Use to craete a new Thread object while inplements Runnable interface in class and want to provide thread name.
  • Thread(String name): Use to craete a new Thread object with thread name.
  • Thread(ThreadGroup group, Runnable target): Use to craete a new Thread object that belongs to the thread group referred to by group, by using Runnable interface
  • Thread(ThreadGroup group, Runnable target, String name): Use to create a new Thread object that belongs to the thread group referred to by group, Runnable interface and Thread name.
  • Thread(ThreadGroup group, Runnable target, String name, long stackSize): Use to create a new Thread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group, and has the specified stack size
  • Thread(ThreadGroup group, String name): Create a new Thread object that belongs to the thread group referred to by group and thread name.
Q- What are the methods in thread class in java?

Q- What are themMethods inherited from class java.lang.Object?

  • equals
  • finalize
  • getClass
  • hashCode
  • notify
  • notifyAll
  • toString
  • wait

No comments:

Post a Comment