运行此代码后,数组不会更改。它的原因是什么?谢谢
Scanner s = new Scanner(System.in);
String [] h = new String[100];
int hlds = 0;
while (true) {
System.out.print("Enter: ");
if(s.hasNextLine()) {
String str = s.nextLine();
if (Pattern.matches("[abc]", str)) {
h[hlds++] = str;
}
for( int i = 0; i < h.length ; i++){
System.out.println(h[i]);
}
break;
}