0

I'm trying to read from file and insert in a row, after inserting I'm having this :

[Ljava.lang.String;@7f059c04
[Ljava.lang.String;@855c8af

The Listener, and BufferRead and Inserting file read.

String filepath = "C:\\imdoingjava\\Java3-Projet\\valuesarticles.txt";
File file = new File(filepath);

private class okListener implements ActionListener{
    public void actionPerformed(ActionEvent event){
        try{
          BufferedReader br = new BufferedReader(new FileReader(file));
          Object [] tableLines = br.lines().toArray();

          for(int i=0; i<tableLines.length; i++){
              String line = tableLines[i].toString().trim();
              String [] dataRow = line.split("\n");
                model.insertRow(0, new Object[] {"", "", dataRow ,""});
          }

        }
        catch(FileNotFoundException fo){
            fo.getMessage();
        }

    }

If I used model.insertRow(0, dataRow); which I commented it, it works but it inserts it in the first column, and I want it in the third.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Elie
  • 23
  • 4
  • 1
    Please look at [How do I print my Java object without getting “SomeType@2f92e0f4”?](http://stackoverflow.com/questions/29140402/how-do-i-print-my-java-object-without-getting-sometype2f92e0f4) – Hovercraft Full Of Eels Feb 10 '20 at 19:40
  • This `[Ljava.lang.String;@855c8af` is the `toString()` returned from a String array. Instead of trying to print the array directly, you will want to for loop to print each array item or use `java.util.Arrays.toString(...)` to print the entire array. – Hovercraft Full Of Eels Feb 10 '20 at 19:42

0 Answers0