Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   cant use runnable (http://www.go4expert.com/forums/cant-use-runnable-t20629/)

cryfreak 9Jan2010 13:50

cant use runnable
when implementing runnable i cant pass a runnable to a Thread.

class A implements Runnable{
    public void run(){
public static void main(String[]args){
    A a=new A();
    Thread t=new Thread(a); // this is where the error occurs

my friends say that it woks fine.i went through a couple of articles on the internet according to them theres no way that code doesnt work.i tried reinstalling jdk that didnt work either.is something wrong with my complier? or is there something i missed? pls help

cryfreak 9Jan2010 13:54

Re: cant use runnable
the error end up getting is "cannot find symbol constructor Thread(A)".when i extend Thread it works fine.and if i leave the thread constructor empty(not passing a runnable)it compiles.

ewaldhorn 16Feb2010 16:43

Re: cant use runnable

I put it all in a java file called A.java and it works as expected?

What IDE / Development environment are you using?

Best regards

All times are GMT +5.5. The time now is 21:03.