I am trying to parse a CSV file that has the format: name, gender, popularity.I want to count all the females present inside the file but I unable to do so. Here's a sample data from the file : Mary, F, 51479. Here's my code :
import java.io.*;
public class CSVFile {
    public static void main(String [] args)throws IOException{
        String file_name = "xyz.csv";
        BufferedReader f = new BufferedReader(new FileReader(file_name));
        String line ;
        int female_count = 0;
        while ((line = f.readLine()) != null){
            String [] values = line.split(",");
            if (values[1] == "F"){
                female_count += 1;
            }
        }
        System.out.println(female_count);
    }
}
Can someone please explain it to me that why is my "if" statement not running? Thank You !!
 
    