Jump to content

I need java help.

Featured Replies

A portion of my Java project says:

 

void getCommand() reads in a line of input and sets up a StringTokenizer Object to parse it later.

 

boolean hasTokens() returns true if the tokenizer Object is not null and still has more tokens, false otherwise.

 

String getToken() returns the next token of the tokenizer.

 

These methods are all in the same class. getCommand(), has no parameters and a void return-type -- getCommand sets up a StringTokenizer called tokenizer.

 

Now, hasTokens() from the same class, also without any parameters, is supposed to determine if the tokenizer I set up in getCommand() hasMoreTokens.

 

Is it even possible to somehow call getCommand.tokenizer.hasMoreTokens() ?

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.