Java: split() returns [Ljava.lang.String;@186d4c1], why?

后端 未结 3 1392
陌清茗
陌清茗 2020-12-18 12:04

And i have no idea why!

I bascially have a STRING (yes, not an array), that has the following contents:

[something, something else, somoething, trall         


        
3条回答
  •  抹茶落季
    2020-12-18 12:22

    You are getting a valid array of Strings, but trying to print it directly does not do what you would expect it to do. Try e.g.

    System.out.println(Arrays.asList(urlArr));
    

    Update

    If you want to process the parsed tokens one by one, you can simply iterate through the array, e.g.

    for (String url : urlArr) {
      // Do something with the URL, e.g. print it separately
      System.out.println("Found URL " + url);
    }
    

提交回复
热议问题