• Post Reply Bookmark Topic Watch Topic
  • New Topic

using the fileReader and the bufferedReader in the correct way  RSS feed

 
mike Vigor
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so I have this code which has to copy numbers made of several rows and 5 columns in an arraylist so that some methods can be called to manipulate the numbers, in loading the numbers into arraylist for a reason or so the numbers are loaded two times...now i post the code and the output...
there is class Row


and there is class make wheel, which accepts the file and load the numbers

there is a file in the folder, milan.txt where the code resides contain a list of numbers like so..


now in void main I did this


so the problem here is that the output is being repeated, if we should take content of the file milan.txt example I gave above, I'm getting an output like so..noticed that in the file the rows were file but in the output I'm having ten rows with the rows being repeated, I think the problem is in constructor MakeWheel where the numbers are copied the arraylist <Row>...how can I make this thing not happen? I mean how can I copy the numbers only once into the arraylist?
0)28 45 61 19 57
1)42 21 20 84 12
2)69 24 61 04 29
3)43 76 54 04 34
4)23 27 30 04 61
5)1)28 45 61 19 57
6)42 21 20 84 12
7)69 24 61 04 29
8)43 76 54 04 34
9)23 27 30 04 61
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ran your code and got this:

Seems to be fine.
 
mike Vigor
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry,
I was calling a certain method twice , one in main and another one in the constructor of another class... my bad
thanks..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!