Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!

Bill Melendez

Greenhorn
+ Follow
since Apr 08, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bill Melendez

I do appreciate your insight into this. I did make the corrections in the last post. I decided to try a different approach using BufferedReader. Still am getting the same problem as the last posted comment from me. I seem to miss the looping sequence somewhere. The txt file only has 6 lines. I can use an arraylist and get the results I need -however, this is just a demo so I can figure out how to do the larger text file with larger amounts of lines. I chose an array because I can specify which jcombobox the lines can go to. I have 20 jcombobox in my entry form and each has a certain amount of selections. The goal was to be able to update them from a text file whenever the selections need changing.


2 weeks ago

Output:

Selection Number One
Selection Number Two
Selection Number Three
Selection Number Four
Selection Number Five
Selection Number Six
2 weeks ago
Thank you. I made the corrections but the output is the same with the same problem. I am thinking that my looping is at fault --just don't know where--since it loops once for the first line and ignores the other lines from the txt file on the first iteration. The second gets the first and second line but then ignores the other lines, and so on..

anything to help is appreciated. With the corrections I get:

Selection Number One
null
null
null
null
null
Selection Number One
Selection Number Two
null
null
null
null
Selection Number One
Selection Number Two
Selection Number Three
null
null
null
Selection Number One
Selection Number Two
Selection Number Three
Selection Number four
null
null
Selection Number One
Selection Number Two
Selection Number Three
Selection Number four
Selection Number Five
null
Selection Number One
Selection Number Two
Selection Number Three
Selection Number four
Selection Number Five
Selection Number Six
BUILD SUCCESSFUL (total time: 3 seconds)
2 weeks ago
I'm stuck on trying to get the code to move from a txt file to an array using scanner. The output doesn't print the correct lines. The txt file has 6 lines (Selection Number One, etc.. up to Selection Number Six) and each line needs to go into the array. The array then needs to print each individual line. I can work it as an arraylist but need an array instead. How do I get rid of the null ouputs? It works with an arraylist --but I need an array. Any help on this is appreciated. Please don't respond with complex coding -I'm just learning java.  I want to use "scanner" not BufferRead.


The output comes out wrong:

Selection Number One
null
null
null
null
null
Selection Number Two
null
null
null
null
null
Selection Number Three
null
null
null
null
null
Selection Number four
null
null
null
null
null
Selection Number Five
null
null
null
null
null
Selection Number Six
null
null
null
null
null
BUILD SUCCESSFUL (total time: 3 seconds)








2 weeks ago