error image i want to view the data that i already add but it shows exception. can refer to the image
public static void viewRecord()throws IOException{
File f= new File("file.txt"); // specify the file name and path here
Scanner sc = new Scanner(f);
System.out.println("ID |Species |Weight |Length |"
+"Num of working flippers|Time |Date |Location |");
while(sc.hasNextLine())
{
String currentLine= sc.nextLine();
String[] tokens = currentLine.split("#");
System.out.println(tokens[0]+"\t"+tokens[1]+"\t\t"
+tokens[2]+"\t"+tokens[3]+"\t"+tokens[4]+"\t\t"+tokens[5]+"\t"
+tokens[6]+"\t"+tokens[7]);
}
sc.close();
}
when i already add the data it shows in the text file in one line not in line by line as i already add the data before