• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

why the program keep looping  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone can help me see, everytime i press 3 or anything to do with displaying data from the txt. file the data keep showing and repeat alot of times.



class file-

.txt data
1|Acer|Aspire 4750G|laptop|1,198|1000
2|Dell|XPS 8300|desktop|1,199|222
3|Dell|1130n|printer|172|1231
4|Apple|ipod Touch|music player|8GB: $328, 16GB:$428, 32GB:588|322
5|Nikon|Coolpix P300|camera|599|324
6|Apple|MacBook|laptop|1348|60
7|Fujifilm|Finepix Jx200|camera|159|279
8|Acer|Aspire M3970|desktop|999|33
9|Fujitsu|Lifebook P521|laptop|599|464
10|Creative|ZEN X-Fi2|music player|8GB:159|54
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code has this pattern
1) Read a line
2) Check the condition of the line in a while loop and execute some logic.
However, your line never changes.

You need to change it so something like

This way, for every iteration, the value of line will change
 
Marshal
Posts: 64483
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using StringTokenizer? Have you read its documentation? Why are you using Readers when a Scanner is so much easier to use?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!