• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

2-what is the use of thread class constructors

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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”);”
----------------------------------------------------------
 
Ranch Hand
Posts: 679
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic