Hi Guys,

I am having this error:

Code:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
and it says that it is in the line:

Code:
 int[] A  = new int[questions.length];
This is the whole code. This is used to generate a set of questions randomly.

Code:
 public void askQuestions(String[] questions, String[] answers) {
      
        int count = 0;
        int point = 0;
        // Create the arrays
        int[] A  = new int[questions.length];
        int[] B = new int[A.length];
        // Create the counters
        int countA = A.length;
        int countB = 0;
        //  adding the indexes to A
       for (int i = 0; i < A.length; i++){
         A[i] = i;
       }

      while (countA > 0){
      Random generator = new Random();
      int pos = generator.nextInt(countA);
      // Adding the index of A at pos to B
      B[countB] = A[pos];
      countB++;
     // Removing the index of A at pos from A
      for (int i = pos; i < A.length - 1; i++)
        {
          A[i] = A[i + 1];
        }
          countA--;
     }