This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes single arrays in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "single arrays in java" Watch "single arrays in java" New topic
Author

single arrays in java

Igor Dobrianski
Greenhorn

Joined: Mar 22, 2003
Posts: 2
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

Joined: Mar 18, 2003
Posts: 118
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

Joined: Aug 03, 2002
Posts: 7729
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 ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
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!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Whaddyamean? I'm bartending under the influence?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: single arrays in java