I can't describe what's my problem

Hi,
I’m creating an app for fun on my phone and I got that… :

Screenshot_20180905-205134

  • [ means array, L means object and java.lang.String means String.
  • So those are arrays of String objects.
  • We can display 1 in Java like this: System.out.println(new String[] {});
  • Alternatively in Processing like this: println(new String[] {}.toString());
1 Like

@Kayno You need to review this sticky post: Guidelines—Tips on Asking Questions

Kf

Hi.
It seems like you want to print out the text of some string arrays but you printed the array instead of the strings inside.
Your code might look like this:

String[][] somestrings = new String[1][3];
somestrings[0][0] = "hello";
somestrings[0][1] = "im";
somestrings[0][2] = "max";
println(somestrings); // I guess you didn't use println but the idea is the same

This should have prints the array instead of the strings.

However you really should use something like this:

String[][] somestrings = new String[1][3];
somestrings[0][0] = "hello";
somestrings[0][1] = "im";
somestrings[0][2] = "max";
for (int i = 0; i < somestrings.length; i++) {
  for (int j = 0; j < somestrings[i].length; j++) {
    println(somestrings[i][j]); // I guess you didn't use println but the idea is the same
  }
}

PS: As I just found out the second for-loop is not strictly necessary in this example.

Yes, of course: but this post has not any reason to be tagged as “android”! - It is exactly the same in Java…