0

The test code is:

String s = "";
System.out.println(s.split("").length);

On Mac and Windows ,the output is 1, but when the string is not empty,like:

String s = "1";
System.out.println(s.split("").length);

On Mac, the result is still 1,while on Windows, the result has changed to 2. Both IDE is eclipse.Why does this occur? As Java's purpose is "Write once ,run anywhere".

ex0ns
  • 1,116
  • 8
  • 19
chaos
  • 1,359
  • 2
  • 13
  • 25

0 Answers0