I am supposed to take this program and use a method to tokenize the inputted string into words and store them into an array of strings. Then use another method to print the array element one word per line. I need help on the first method, trying to tokenize and store into an array.
import java.util.*;
public class Tokenizer {
public static void main(String args[]){
int i=1;
Scanner scan =new Scanner(System.in);
System.out.println("Enter a String: ");
String st = scan.nextLine();
StringTokenizer Tokens = new StringTokenizer(st);
while(Tokens.hasMoreTokens())
System.out.println(i++ + ": " + Tokens.nextToken());
}}