aspose file tools*
The moose likes Threads and Synchronization and the fly likes 2-what is the  use of thread class constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "2-what is the  use of thread class constructors" Watch "2-what is the  use of thread class constructors" New topic
Author

2-what is the use of thread class constructors

shankara me
Greenhorn

Joined: Nov 30, 2012
Posts: 14
Hi !last time I asked one doubt with heading “what is the use of thread class constructors”.But I could not ask that doubt in a right manner.Now I am asking the same doubt in a simple and clear manner.My doubt is on Thread class constructors. My doubts based on below simple code.In below code in main method there is a statement as ” Thread C4=new Thread (new first(),"FIRSTTHREAD");”
This Statement Will create a Thread FIRSTTHREAD for the class “first”.
Here we used Thread class constructor
public Thread(Runnable target,String name);
There are some other constructors in Thread class like
1)public Thread();
2) public Thread(String name);
The first constructor is used to create an object of Thread class.
The second constructor is used to create an object of Thread class but with required name.
Then my question is
-->What is the benefit of creating object to thread class?
-->A class named with” four” is available in below code.By using second constructor of above constructors is it possible to write “four f1=new four(“MYTHREAD”);”
----------------------------------------------------------
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 679
shankara me wrote:-->A class named with” four” is available in below code.By using second constructor of above constructors is it possible to write “four f1=new four(“MYTHREAD”);”

What happened when you tried it ?
If you experiment and then ask specific questions if you don't understand the results of those experiments, people will be able to help you better.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: 2-what is the use of thread class constructors
 
Similar Threads
Concurency logic
thread doubt
SCJP / strange behaviour when using Thread-Constructor
Threading synchronization
starting a thread in a constructor