| | |
thread question
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
You can have the class extend the Thread class.
If you don't want to change the code of the old class though you can try to create a new one that extends the old and implements the Runnable interface:
Runnbale
If you don't want to change the code of the old class though you can try to create a new one that extends the old and implements the Runnable interface:
Runnbale
Java Syntax (Toggle Plain Text)
public NewClass extends OldClass implements Runnable { public void run() { ...... } }
Check out my New Bike at my Public Profile at the "About Me" tab
•
•
Join Date: Apr 2008
Posts: 1,016
Reputation:
Solved Threads: 150
You can use an anonymous inner class. Something like:
Java Syntax (Toggle Plain Text)
new Thread(){ public void run() { // some lines of code } }.start();
![]() |
Similar Threads
- Windows question (Python)
- Best practices question (C++)
- why is a thread "closed"? (DaniWeb Community Feedback)
- simple thread question (C++)
- simple question regarding array (C++)
- thread question (Java)
- quick question (C)
- One more question about Remote desktop (Networking Hardware Configuration)
- qbasic program under Windows XP (Legacy and Other Languages)
Other Threads in the Java Forum
- Previous Thread: Database
- Next Thread: File reading problem
| Thread Tools | Search this Thread |
Tag cloud for Java
actuate android api apple applet application arguments array arrays automation banking binary bluetooth character chat class classes client code component constructor crashcourse database design developmenthelp draw eclipse error event exception file fractal game givemetehcodez graphics gui helpwithhomework html ide if_statement image input integer interface j2me java javaarraylist javadoc javaee javamicroeditionuseofmotionsensor javaprojects jetbrains jmf jni jpanel julia linux list loop map method methods mobile multithreading netbeans newbie number oracle pearl print printing problem program programming project property recursion remove scanner screen server set size sms socket software sort splash sql stop string swing test textfield thread threads time tree validation windows






