2

Can someone explain to me why the output is the same for this two? //S means non-whitespace. Thanks

public static void main(String[] args){

    String test = "I am noob ";
    String[] tokens = test.split("\\S");
    System.out.println(tokens.length);

    String test2 = "I am noob 132434";
    String[] tokens2 = test2.split("\\S");
    System.out.println(tokens2.length);
}
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
Philip Morris
  • 459
  • 1
  • 9
  • 26

0 Answers0