Hey guys,
I need to produce an output such as {{0,0,0,0,0}{0,0,0,0,0}{0,0,0,0,0}{0,0,0,0,0}{0,0,0,0,0}};
I have no input paramethers so I assume I need to have int[] array= {0,0,0,0,0} and then make 2d array of it?

I tried

int [][] arrayOfSets = new int[0][25];
        int [] a = {0,0,0,0,0};
        for(int i=0; i<1;i++){
            for(int j=0;j<5;j++){
                array2d[i][j] = a[i]; 
               }
        }
        return arrayOfSets;

But I get error array value is required pointing at a[i]

Any suggestions/ideas?

int [][] arrayOfSets = new int[5][5];
        int [] a = {0,0,0,0,0};
        for(int i=0; i<5;i++){
            for(int j=0;j<5;j++){
                arrayOfSets[i][j] = 0; 
               }
        }
        return arrayOfSets;

This solved it, had a typo in the code =D but I only got 1 star for it :( Any ideas on improving it?

Got it ;)

Yes, you can improve it:

int [][] arrayOfSets = new int[5][5];

and that's it, an array of type int will have a 0 in each cell by default.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.