I'm rather new to java so apologise if this is a stupid question.
I have the following function
public static List<String[]> read(String document) throws IOException{
try{
CSVReader reader = new CSVReader(new FileReader(document));
List<String[]> data = reader.readAll();
reader.close();
} catch(IOException e){
e.printStackTrace();
}
return data;
}
however i am getting an error that data cannot be resolved to a variable. However if i but the return in the try statement the error goes away and states that the function should return. As the variable is inside the function i would have thought that regardless of the catch it would of allowed this. Can anyone explain to me where I am going wrong?