I have a .CSV file with rows for [ID], [NAME], [LASTNAME], [EMAIL], [GENDER]. There are 1000 entries
I need the code to give me the total number of ID-s in the list. After this is complete, the code must separately show FIRST 10 in the specific array.
Currently, it only shows the full ID-section in all of it's extent. The .lenght() does not seem to work to count the total, it counts all the numbers in the array instead.
public static void main(String[] args) {
// TODO Auto-generated method stub
String fileName="test.csv";
File file = new File(fileName);
try {
Scanner inputStream = new Scanner(file);
inputStream.next();
while (inputStream.hasNext()) {
String data = inputStream.next();
String[] values = data.split(",");
System.out.println(values[0]);
}
inputStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();