ReadFiles.java line 29 has a syntax error. It keeps highlighting else but I am not sure how to fix it. Any ideas?
//This program is to Figure out whether it can find data
import java.io.*;
import java.util.StringTokenizer;
public class ReadFiles {
//This finds the info and put it in a string
File file = new File("C:\\stocks\\intro.csv");
//Define how many rows in a file
int row = 0;
// Need to change the file into an 2d array
String [][] items;
//Check if the file is a file
public boolean checkIsFile(){
//returns file if " " file exists
return file.isFile();
}
//find number of row in csv file
public int findRowNumber(){
row=0;
if(checkIsFile());{
//do this if its a file
try{
BufferedReader reader = new BufferedReader(new FileReader(file));
while((reader.readLine()) !=null){
row++;
}
}catch(Exception e){
System.out.println(e);
}
}else{
System.out.println("This is not a file");
}
return row;
}
}
//Main program
public class StockMarket {
public static void main(String[] args) {
//initialize and object
ReadFiles r = new ReadFiles();
System.out.println(r.findRowNumber());
}
}