Hello , i am starting with java. I need to school make program that generates random numbers 1-20 , a than make method to check duplicates and replace them ... i find on the internet only methods with array or something like that , i cant use that because i dont know that... problem is i dont know how many numebrs it will be , i must enter how long it will be by user , and than check it ... numbers must be in field (array? im not sure with this word , im czech a[0],a[1] etc.)...
i need to do it with if,else,while,do ....
hokiii
0
Newbie Poster
Recommended Answers
Jump to Postyou will need an array anyway. how else are you going to check (in at least somewhat an efficient way) whether or not the number you just generated is a duplicate of one you've already found or not?
it's either an array or almost twenty extra variables: very inefficiënt and …
All 3 Replies
stultuske
1,116
Posting Maven
Featured Poster
hokiii
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.