My program -
class RunnableA implements Runnable{
public void run(){
System.out.println("Program A");
}
}
class MyThread extends Thread{
}
class Demo{
public static void main(String args[]){
RunnableA a1=new RunnableA();
a1.start();
}
}
And I got this when compiling.
Demo.java:12: error: cannot find symbol
start
is a method of Thread
class, not a method of the Runnable interface.
Here's a way to start a Thread
that would run your Runnable's logic :
class Demo {
public static void main(String args[]){
RunnableA a1=new RunnableA();
new Thread(a1).start();
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments