• 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 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

WordCounter array problems

 
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a quick question. My main method listed below will not pass my array values into my constructor WordCounter. Is is due to the instantiation of t1 in my for loop? I know the array is being filled correctly with the strings because I can test it with a SOP, and it outputs correctly. Im just wondering why this doesn't work.
The constructor in my WordCounter class accepts a String object.
It works when I instantiate all 4 objects individually, but I was hoping to get away with this code.
Thanks in advance.

And here is the constructor for WordCounter:


[ January 20, 2004: Message edited by: Steve Wysocki ]
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My main method listed below will not pass my array values into my constructor WordCounter.
How do you know this? Try putting a print statement inside the constructor to see what if any value it's seeing.
Also, this line does nothing:

That is, it does execute the toString() method, which creates a string. But it doesn't do anything with that string afterwards. Try:

[ January 20, 2004: Message edited by: Jim Yingst ]
 
Gabriel White
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jim, total brain fart here on my part.
I can't believe I just posted that.
Thanks for your help.
Steve
[ January 20, 2004: Message edited by: Steve Wysocki ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic