4

I am trying to built an app inside my Mac using Eclipse

String h="asd";

    String o[]=h.split("");
    System.out.println(o.length);

the result is: 4 .which is wrong but in windows its gives :3 .which is correct

both Mac and windows is up to date

Faris sy
  • 61
  • 1
  • 5
  • Shouldn't have any problems really going between a Mac and a Windows box. Only thing I can think of would be that it's some weird character encoding issue, or an extra space. – Mike Palfrey Nov 25 '15 at 14:44
  • 7
    Are you using the same Java version ? There is a difference in Java 8, see http://stackoverflow.com/questions/22718744/why-in-java-8-split-sometimes-removes-empty-strings-at-start-of-result-array – Patrick Nov 25 '15 at 14:52

0 Answers0