stringtokenizer problems :(
can someone tell me why my code isnt working, i want my while statement to run while a full name hasnt been entered using the tokens method, however i am having trouble its only registering the one even when i put more then one name in the input :( someone please help its urgent.
Scanner console = new Scanner(System.in);//New Scanned named console
String Name = "";//Where full name will be stored.
int tokenCounter = 0;//Token Counter variable
String inputLine;//inputLine has the data type String
my while statement:
while ( tokenCounter < 2 )
{
System.out.print("Please enter your full name:");
Name = console.next();
StringTokenizer st = new StringTokenizer(Name);
tokenCounter = st.countTokens();
System.out.println("Number of tokens = " +tokenCounter);
}
my test code worked standalone but not when i used an input :(
this was the test code:
String text = "work **** it";
StringTokenizer st = new StringTokenizer(text);
System.out.println (st.countTokens());

