import java.util.StringTokenizer;
public class josimarleewords {
private static String[] tokenize(String str) {
StringTokenizer tokenizer = new StringTokenizer(str);
String[] arr = new String[tokenizer.countTokens()];
int i = 0;
while (tokenizer.hasMoreTokens()) {
arr[i++] = tokenizer.nextToken();
}
return arr;
}
public static void main(String[] args) {
String[] strs = tokenize("He said, That's not a good idea.");
for (String s : strs)
System.out.println(s);
}
}
答案 0 :(得分:2)
如果您的文件名为Josimarleewords.java,那么您的类必须被称为Josimarleewords。确保你把第一个字母大写。