[JAVA LANGUAGE]i need to read 2 csv files which contains amatrix in each file. i need to add them and print the output
Answer
*Note: Since there is no size mentioned for the matrix,I am considering a 3×3 matrix is stored in both the CSV filesas:
file.csv
file2.csv
Code:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class Test {
public static void main(String[] args){
String line = “”;
int i=0;
int Value1[][]=new int[3][3];
int Value2[][]=new int[3][3];
int Sum[][]=new int[3][3];
try (BufferedReader br = newBufferedReader(newFileReader(“C:UsersCheggDesktopfile.csv”))) {
while ((line
OR
OR