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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Threads

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
//READ FILE W/STRING TOKENIZER & STORE VALUES IN VARIABLES
while ((sline = br.readLine()) !=null)
{
StringTokenizer st=new StringTokenizer(sline, ",");
intA = Integer.parseInt(st.nextToken());
intB = Integer.parseInt(st.nextToken());
TrArray[intTr] = new Tr(intA, intB, tnl);
ThreadArray[intTr] = new Thread(TrArray[intTr]);
ThreadArray[intTr].start();
}


I am reading a file from the command line which contains several lines. Each line contains 2 integers separated by a comma. (intA, intB). A Tr object is created (consisting of the 2 integers & tnl object) & assigned to an array as each line is read. Then each object needs to be assigned to a thread & started.

Error occurs on the: ThreadArray[intTr] = new Thread(TrArray[intTr]) line
Error received is:
Cannot resolve symbol constructor thread Train

Any help would be appreciated

Thanks�Alex
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Alex,
Please don't cross-post the same question in multiple threads.
 
Something about .... going for a swim. With this tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic