Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Looping and printing String array from a different class  RSS feed

 
Nick Sar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my first class, I am reading a csv file with bufferedreader and storing it in the String array named "Part" by splitting the data stored by a comma with this

For test purposes I then print at the data I need in position "0" and "1" of the string array for every entry in the csv file.


This works but for the other class, I need to take the value stored in position "0" of the String array from "Part" and use that to find an exact match in another csv file. Once it finds it it stores it in another String array and again prints it out for test purposes and loops back and runs the next value in the "Part" string array in position "0" to find that in the second file. My problem is actually making it loop through the "Part" array from the other class. Right now it just searches and find only the last value stored from the "Part" array.

He is what I have for the class I am having trouble with



Assume the try/catch/finally is implemented properly.

Also I tried the best I could at explaining what I'm trying to do
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick,

You are hung up in your thought process on this whole String array issue, and I don't think you need it.

You use YourArray[0], which is a String, to search through a file, if that String is found in the line, then you split the line and use the 2nd and 9th String from the resulting array for something. So just pass the String you need to the second Object.

Les
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!