Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

single arrays in java

 
Igor Dobrianski
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can figured out what i do wrong.
I try to write simple program that inputs 20 numbers from user and display them in fange from 10 to 100, only if not duplicated.

(Marilyn added code tags to display formatted code)
[ March 22, 2003: Message edited by: Marilyn de Queiroz ]
[ edited to alleviate the pain of scrolling left and right -ds ]
[ March 23, 2003: Message edited by: Dirk Schreckmann ]
 
Jonas Isberg
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A few things to think about:
1. Why do you have i++ on two places in your for loop in your pick method?
2. What should happen to i when a duplicate is found, should it still be increased?
I think these things should correct your problem, if not, please state what the program does and what you think it should do instead. Good luck!
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you get when you compile the code?
Do you get an exception when you run the program?
You are also creating a lot of InputStreamReaders and BufferedReaders here. Maybe it's better to create only one pair and reuse them.
[ March 23, 2003: Message edited by: Barry Gaunt ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are also creating a lot of InputStreamReaders and BufferedReaders here. Maybe it's better to create only one pair and reuse them.
Go Cattle Drive!
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whaddyamean? I'm bartending under the influence?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic