aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "thread" Watch "thread" New topic


Hasitha Randika
Ranch Hand

Joined: Sep 04, 2007
Posts: 50
class A extends Thread{
public void main(){
A(Runnable r){

class B implements Runnable{
public void run(){
class C{
public static void main(String ar[]){
A a = new A();
B b = new B();
Thread t =new Thread();
b.start();// this is a compilation error //line 1
in the above code syntax line 1 gives a compile error why's that?
do i have to use a construcor if i implement the runnable interface
Vas Golla

Joined: Aug 09, 2007
Posts: 8
new Thread(b).start();
will work if used Runnable.
You tried to call start() on a Runnable where as start() is to be from a Thread.
I agree. Here's the link:
subject: thread
It's not a secret anymore!