dimanche 27 novembre 2016

Return statment for an array is unreachable [on hold]

import java.util.Random;

public class game {

    private static Random rand = new Random();

    private static int[] pick6(int max) {
        int [] pick6 = {1, 1, 1, 1, 1, 1};
        for (int i = 0; 1<6;i++) {
            pick6[i] = rand.nextInt(max);
        }
        return pick6; //unreachable code
    }


    public static void main(String [] args) {
        int [] pick6 = pick6(10);
        for (int i = 0; i<=6; i++) {
            System.out.println(pick6[i]);
        }
    }
}

Is my method of creating a random array off, or is there some underlying problem I am missing?




Aucun commentaire:

Enregistrer un commentaire