0
import java.util.*;
public class Main
{   
public static void main(String[] args) 
    {   
        double[][] numbers=new double[10][];
        Random numGen =new Random();
        for(int pos=0;pos<numbers.length-1;pos++)
            {
            int index=0;
            numbers[pos][index]=Math.abs((100)+numGen.nextInt(100));  
            System.out.printf("The random number stored in [%d][%d] : %9.4f",pos,index,numbers[pos][index]);
            System.out.println();}
    }
}

Error: I get the error in the line" numbers[pos][index]=Math.abs((100)+numGen.nextInt(100));" Exception in thread "main" java.lang.NullPointerException
at Main.main(Main.java:11)

Jasmine
  • 1
  • 1

0 Answers0