Is there a way to create some type of For loop to separate a string with spaces? So far I can display a string and find how many characters it has.
import java.util.Scanner;
import java.lang.String;
public class Word{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int b;
String word;
System.out.println ("Enter a word: ");
word = scan.next();
b = word.length();
System.out.println (word);
System.out.println (b);
}
}