Please someone help I am trying my best to try to find a way to convert a 2d array into an arraylist so that I can access previous elments with get method effectively. Also in 2d array itself while using 2 for loops one to loop through row and other to loop through column is there a way to change previous or coming up values of loop in that. Means if I am currently using values of a[i][j], in the same loop can I use a[i+1][j] and a[i+2][j].
I TRIED TO SOLVE THROUGH ALREADY ASKED QUESTION BUT I AM NOT ABLE TO SOLVE IT. I WENT THROUGH THAT SOLUTION BEFORE AS WELL AND AFTER IT WAS MARKED AS DUPLICATE THEN ALSO. EVERY QUESTION ASKED WITH INTENTION OF LEARNING AND SOLVING A PROBLEM FOR WHICH WORKING FROM MANY DAYS DESERVES AN ANSWER. PLEASE HELP.
package abc;
import java.awt.List;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class matrix_removeDownwards {
public static void main(String args[]) {
// entering 2d array elments
Scanner scan = new Scanner(System.in);
System.out.println("Enter no of rows u want");
int row = scan.nextInt();
System.out.println("Enter no of columns u want");
int col= scan.nextInt();
int a[][] = new int[row][col];
System.out.println("Enter ur array");
for(int i = 0; i<row; i++) {
for(int j=0;j<col; j++) {
a[i][j]=scan.nextInt();
}
}
// defining a list
//ArrayList<Integer> list = new ArrayList<Integer>(a);
java.util.ArrayList<Integer> list = new java.util.ArrayList<Integer>
``(Arrays.asList(a));
list.toArray(a);
//List<List> list = new ArrayList<List<a>>();
}
}