Results 1 to 9 of 9
Thread: Thread !!
- 04-23-2012, 12:00 PM #1
Member
- Join Date
- Jan 2012
- Posts
- 55
- Rep Power
- 0
Thread !!
Hi all,
I wrote a simple thread code like below.
class Mythread implements Runnable
{
public void run()
{
dojob();
}
public void dojob()
{
System.out.println("hi");
}
public static void main(String[] args)
{
Mythread mt = new Mythread();
Thread td = new Thread(mt);
td.start();
}
}
Now when i run the above code i get compile time error stating "cannot find symbol new Thread(mt)", "cannot find symbol td.start()" !!
Can any one kindly tell me what the problem might be?
Regards
- 04-23-2012, 12:14 PM #2
AN21XX
- Join Date
- Mar 2012
- Location
- Munich
- Posts
- 297
- Rep Power
- 2
Re: Thread !!
I see no error - works fine when I compile it in Eclipse Indigo
- 04-23-2012, 12:24 PM #3
Member
- Join Date
- Jan 2012
- Posts
- 55
- Rep Power
- 0
Re: Thread !!
No try running that through simple command prompt.
- 04-23-2012, 12:34 PM #4
Re: Thread !!
Why do they call it rush hour when nothing moves? - Robin Williams
- 04-23-2012, 12:35 PM #5
AN21XX
- Join Date
- Mar 2012
- Location
- Munich
- Posts
- 297
- Rep Power
- 2
Re: Thread !!
Hmmm prints a "hi" to my screen - how do you compile it?
Maybe give me the line you use to run it on your system?
- 04-23-2012, 12:38 PM #6
Re: Thread !!
Delete any Thread.java /Thread.class files that you have created yourself.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-23-2012, 12:39 PM #7
Member
- Join Date
- Jan 2012
- Posts
- 55
- Rep Power
- 0
Re: Thread !!
compile >>> javac Mythread.java
Run >>> java Mythread
- 04-23-2012, 02:09 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: Thread !!
You haven't got another class called Thread in that directory have you?
Please do not ask for code as refusal often offends.
- 04-23-2012, 03:32 PM #9
Member
- Join Date
- Jan 2012
- Posts
- 55
- Rep Power
- 0
Similar Threads
-
Main Thread not waiting for grand child thread to finish
By prashanthn in forum Threads and SynchronizationReplies: 3Last Post: 06-07-2011, 09:26 AM -
Difference between Thread.yield() and Thread.sleep() methods
By Nageswara Rao Mothukuri in forum New To JavaReplies: 12Last Post: 07-30-2010, 05:37 PM -
how to reduce the thread sleep time and wake up the thread
By baktha.thalapathy in forum Threads and SynchronizationReplies: 2Last Post: 06-24-2010, 07:36 PM -
If JNI thread call the java object in another thread, it will crash.
By skaterxu in forum Advanced JavaReplies: 0Last Post: 01-28-2008, 07:02 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks