alright, this is the last bit of help i need for the program, we have been asked to create a lotto type program, since i finished early i've decided to add some error checkers. one being that you cannot enter the same number twice.

hey mate, i think i see what you're doing there. could you please explain this to me; Arrays.fill(userinput, -1);
thanks.
cheers,
luke.

May 27th, 2009, 08:10 AM

JavaPF

Re: last one

Quote:

Originally Posted by luke

hey mate, i think i see what you're doing there. could you please explain this to me; Arrays.fill(userinput, -1);
thanks.
cheers,
luke.

I have used this because the default array values are 0. When we loop through the array to check for duplicate entries, because 0 already exists, the message is printed asking you to enter another unique value. By setting all the array values to -1 first, this stops that from happening. If the range was 1 to 40 rather than 0 to 40 then we wouldn't need to do this. I hope you understand :-?

May 28th, 2009, 01:51 AM

luke

Re: last one

understand perfectly, i will not mark this thread as solved though as i plan to ask another question on it later tonight.

cheers,
luke.

May 28th, 2009, 04:36 AM

luke

Re: last one

alright, very last bit of it.

Quote:

package lotto;

import java.util.*;

public class Main {

public static int[] userinput = new int[6];// declaring a new array of chars
public static int[] Computernumber = new int[6];