File variable with output [Ljava.lang.String;@

Asked

Viewed 35 times

1

When I do a Sysout of my variable type File, I get this output:

[Ljava.lang.String;@3e92957f

And my sysout is like this:

System.out.println(entrada.getPath() + " " + saida.getPath());

The funny thing is that in saida.getPath() the exit is exactly what I want. Someone knows why?

1 answer

1

I found the error using the method instanceof in the object, I was able to transform into String straight. For those who have the same doubt, here is the code:

for (Object obj : objArr) {
     if (objeto instanceof String[]) {
     String[] strArray = (String[]) objeto;
     System.out.println(Arrays.toString(strArray));
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.