COMPARING 2 COLLUMSN IN TWO CSVS IN JAVA
===

I have two csv both with a primary key, im trying to comapre both keys so that i can combine the related csvs to one with the correct keys, however for now i just wanted to compare what was in collumns one. My mind is a little blank i hope by the code you can sort of figure out the direction im going. im unable to get my arrays to actually take in the strings . Java.lang.arrayindexoutofboundsexception

<code>import java.io.*;
import java.util.*;





public class UDC {
	public void search(String [][] wat, String [][] ud){
		
		
	}
	
	
	public static void main (String [] args) throws IOException
	{
		String [] [] cols = {};
		String [] [] cols1={};
		int row =0;
		int row1 =0;
		int j = 0;
		
		
	/*Scanner s = new Scanner(new File("Watford Update File.csv"));
	Scanner c = new Scanner(new File("udc.csv"));
	while (s.hasNextLine()){
		String line = s.nextLine();
		cols =line.split(",");
		System.out.println(cols[0]);*/
		Scanner s = new Scanner(new File("udc.csv"));
		Scanner w = new Scanner (new File("Watford Update File.csv"));
		while (w.hasNextLine())
			
		{
			String line1 = w.nextLine();	
			System.out.println(cols);
			//cols[row]=line1.split(",");
			row ++;
			if(!w.hasNextLine()){
			while (s.hasNextLine()){
			String line2 = s.nextLine();
			 //cols1[row1]=line2.split(",");
			//put while loop in diffrent method but break
			
				
				if(cols[j].equals(cols1[row1]))
				{
					
					j++;
					row1++;
					System.out.print(cols[j]);
					System.out.print(" ");
					System.out.print(cols1[row1]);
					System.out.println();
					
				}else{
					row1++;
					
				}
				
			}
			
			
		}
		}
	
	}
		
}</code> 