i currently have an array of 20 numbers. how do i set all the cells in that array to have the same number that is specified by the user?
arrays
Collapse
X
-
well here is an idea the user enter the numbers so you check if the first number entered by the user is different from the others you will try agin and reenter the dataOriginally posted by aisekii currently have an array of 20 numbers. how do i set all the cells in that array to have the same number that is specified by the user? -
You could do it the 'mechanical' way by using a loop and setting each and everyOriginally posted by aisekii currently have an array of 20 numbers. how do i set all the cells in that array to have the same number that is specified by the user?
element to that value but that has been done before; have a look at the Arrays
utility class and this little code snippet:
[code=java]
Arrays.fill(you rArray, userSpecifiedVa lue);
[/code]
kind regards,
JosComment
Comment