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);
}
}
Asked
Active
Viewed 1,794 times
1

Gary
- 13,303
- 18
- 49
- 71

Josimar Lee
- 11
- 2
-
1You mean the code above is in a file called `josimarleewords.java`, right? – ericbn Mar 29 '17 at 14:57
-
Please edit your question to ask a question – James Fry Mar 29 '17 at 16:00
1 Answers
2
If your file is called Josimarleewords.java, then your class must be called Josimarleewords. Make sure you capitalize the first letter.

Edd
- 1,350
- 11
- 14
-
2Worth noting, your class should be capitalised regardless because that is the convention. – Michael Mar 29 '17 at 14:59
-