Back
I want to generate a 2D array of type double. How can I do it?
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; }}
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.
31k questions
32.8k answers
501 comments
693 users