考题求助 正则
这个题目的答案怎么解释啊
import java.io.*;import java.util.*;import java.util.regex.*;public class SCJP { public static void main(String args[]){ String input ="10 apples 20 oranges 33 pears"; Scanner s=new Scanner(input).useDelimiter("\\d*"); System.out.print(s.toString()); String str[]=new String[6]; int i=0; while(s.hasNext()){ str[i]=s.next(); System.out.println(str[i++]); } s.close(); }}
public static void main(String args[]) { String input = "10 apples 20 oranges 33 pears"; Scanner s = new Scanner(input).useDelimiter("\\d+"); System.out.println(s.toString()); String str[] = new String[6]; int i = 0; while (s.hasNext()) { str[i] = s.next(); System.out.println(str[i++]); } s.close(); s.close(); }