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,126
  • 7
  • 17
weaver
  • 1,081
  • 2
  • 9
  • 23

0 Answers0