explain how to pass parameter to thread??
sathya88 0 Junior Poster in Training
Recommended Answers
Jump to PostIf you are using another class
…public class Constructor_benifit{ public static void main(String[] args){ System.out.println("In primary Thread"); A a=new A("Test string for secondary thread"); Thread thread_object=new Thread(a); thread_object.start(); } } class A implements Runnable { String to_print; A(String to_print){ this.to_print=to_print; } public void run(){ System.out.println(to_print); } }
Jump to PostJeffGrigg , You are correct.. The way i have answered was to make beginner to understand in a better way.
All 8 Replies
LevyDee 2 Posting Whiz in Training
Muralidharan.E 14 Junior Poster in Training
JeffGrigg 170 Posting Whiz in Training
Muralidharan.E 14 Junior Poster in Training
NormR1 563 Posting Sage Team Colleague
JeffGrigg 170 Posting Whiz in Training
NormR1 563 Posting Sage Team Colleague
Muralidharan.E 14 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.