0

I have a method named readBabyNameData

public void readBabyNameData(String filename){
    try{ 

        // open the text file and use a Scanner to read the text
        FileInputStream fileByteStream = new FileInputStream(filename);
        Scanner scnr = new Scanner(fileByteStream);
        scnr.useDelimiter("[,\r\n]+");

In my test class, I'm trying to use this method to input a text file (named MySampleData.txt) I have created (It is in the project folder).

public static void main(String args[]){
    BabyNameDatabase db = new BabyNameDatabase();

    db.readBabyNameData("MySampleData.txt");

When I run the main method to test my program, it does gives me a InputMismatchException error from the software that I'm using (BlueJay). Any suggestions?

0 Answers0