Search code examples
javastringswingobjectjtextarea

Convert Object[][] to String? Java Swing


I need to convert an Object[][] that looks like this:

Object[][] numbers =
  {"1", "12-22", "12-22"},
  {"2", "12-22", "11-14"},
  {"3", "12-22", "11-14"};

I tried:

m1.textArea.setText((b1.returnNumbers).toString());

Solution

  • You can use the deepToString method:

    m1.textArea.setText(Arrays.deepToString(b1.returnNumbers));