Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

I want to generate a 2D array of type double. How can I do it?

1 Answer

0 votes
by (13.1k points)

You can do it like this:

double[][] arr = new double[4][4];

for(int i=0; i<4; i++) {

    for(int j=0; j<4; j++) {

        arr[i][j] = i*j;

    }

}

Want to learn Java? Check out the Java course from Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 30, 2019 in Java by ParasSharma1 (19k points)
0 votes
1 answer
0 votes
0 answers
0 votes
1 answer
asked Jan 24, 2021 in Java by dante07 (13.1k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...