Answer the question
In order to leave comments, you need to log in
How to fill an array from 275 to 834?
1. There is an array:
2. Given a random number generator:
question: How to fill an array with integer values ranging from 275 to 834 inclusive?
p.s. what i did:int[] array = new int[15];
int value = random.nextInt(275)+ 559;
Random random = new Random();
int value = random.nextInt(275)+ 559;
int[] arrays = new int[15];
while (arrays.length != value){
arrays+value;
}
}
Answer the question
In order to leave comments, you need to log in
while (arrays.length != value)
Why are you comparing the array length (always 15) with a random number (275-834)? The condition will never be false and you will never exit the loop
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question