import acm.program.*;
import java.util.*;
public class TokeniseString extends ConsoleProgram {
public void run() {
println("This program tokenises a string.");
String str = readLine("Please enter a string: ");
StringTokenizer tokeniser = new StringTokenizer(str, " ");
for (int i=0; tokeniser.hasMoreTokens(); i++) {
println(tokeniser.nextToken());
}
}
}
import java.util.*;
public class TokeniseString extends ConsoleProgram {
public void run() {
println("This program tokenises a string.");
String str = readLine("Please enter a string: ");
StringTokenizer tokeniser = new StringTokenizer(str, " ");
for (int i=0; tokeniser.hasMoreTokens(); i++) {
println(tokeniser.nextToken());
}
}
}