-5

I am getting both these errors (on the marked line) with the following code in java;

    String data[] = file.getInput();

    while(data[0] != "X"){
        String ID = data[0];
        String firstName = data[1];
        String lastName = data[2];

        data[] = file.getInput(); //errors occurr here  
    }

Note that file.getInput() is a method that returns an array of Strings from a CSV file using the InputReader.

2 Answers2

1

Just remove the [] from data.

data = file.getInput();
Eldelshell
  • 6,683
  • 7
  • 44
  • 63
0

Remove the ‘[]’ from data :

data = file.getInput();  ‘Do the statement like this’
Lucifer Rodstark
  • 206
  • 4
  • 14