• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

thread doubt

 
Ranch Hand
Posts: 481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class TSamp extends Thread{
public native String getTime();

}
public class Multi implements Runnable {
boolean bStop;
public static void main(String argv[]){
Multi m = new Multi();
m.go();
}
public void go(){
TSamp ts = new TSamp(this);
ts.start();
bStop=true;

}
public void run(){
if(bStop==true){
return;
}
System.out.println("running");
}

}

Here when i compiled I got the output as
---------- javac ----------
Multi.java:12: cannot resolve symbol
symbol : constructor TSamp (Multi)
location: class TSamp
TSamp ts = new TSamp(this);
^
-------------------------------------

I am getting whats going wrong here.

Please explain .
 
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Look at your class TSamp : you don't delare any constructor...

So a default Zero-arg one will be created.

You can't create an instance of TSamp with new TSamp(Multi)...

Add a constructor :

 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Seb Mathe:
Hi,

Look at your class TSamp : you don't delare any constructor...

So a default Zero-arg one will be created.

You can't create an instance of TSamp with new TSamp(Multi)...

Add a constructor :



Instead, create a constructor
    Bookmark Topic Watch Topic
  • New Topic