Counting total number of options available in dropdown

Please let me know where the value return by getNumberOfTotalOption is stored.

The returned value is not stored in a variable. It is calculated everytime getNumberOfTotalOption is called.

You can read the source code of the getNumberOfTotalOption keyword here:

line 80:

int num = select.getOptions().size()...return num