go to previous page   go to home page   go to next page
myObject.age = 13.6;

Answer:

Six. The tokens are:    

 
myObject  
.  
age  
=  
13.6  
;  

Delimiters

Sometimes '.' is a token by itself, and sometimes it is part of a token. Tokens are delimited (separated from each other) by white space and by those tokens that can act as delimiters. The token age is delimited by the token '.' on the left, and by white space on the right. The token 13.6 is delimited by white space on the left and by the token ';' on the right.

The statement

myObject . age=13.6  ;

has the same tokens as the previous statement, but uses different delimiters. Now age is delimited by space on the left and by = on the right. There are many ways that equivalent statements might be formatted, but a scanner must extract the same tokens for all of them.

The characters that act as delimiters depends on the language. In the Java statement:

value = sum-debit;

minus (-) acts as a delimiter. But a spelling checker might regard it as part of a word.


QUESTION 4:

In Java, does '-' always act as a delimiter?