String Array length is showing 1 even the array is empty after call split by comma (,)
arrays, java
Solution
From the doc:
If the expression does not match any part of the input then the resulting array has just one element, namely this string.
Note that this doc is from the `String.split(String, int)` method, which is invoked from `String.split(String)`
Problem
Here is my code: ``` serialNumbers = ""; String[] serialArray = serialNumbers.split(","); int arrayLength = serialArray.length; ``` arrayLength is showing 1 even there have no value in serialArray. I was expecting that length should return 0 in this case.