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
  • 697,062
  • 78
  • 1,055
  • 1,465
Philip Morris
  • 461
  • 1
  • 8
  • 23

0 Answers0