[Solved] Split array into subarray java


This should work. As mentioned in the comments. a is not a string but an array. So you need to iterate over it to call the split() method on it’s containing strings

String s = "How are you?"
String[] a = s.split("\\s");
for(String s2 : a){
    String[] a2 = s2.split("");
    // do your stuff with a2 in every iteration
}

5

solved Split array into subarray java