How many different variable names are there in JAVA? Combinatorics Question

The name of a variable in the JAVA programming language is a string of $1$ to $65,535$ characters, where each character can be an uppercase or a lowercase letter, a dollar sign, an underscore, or a digit. Furthermore, the first character in the string must not be a digit. How many different variable names are there in JAVA?

I know there are the following characters:

• $26$ Lowercase Letters
• $26$ Uppercase Letters
• $1$ Dollar Sign ($) -$1$Underscore(_) For a total of$54$ways. I am unsure where to go from this point. If this could be worked out with an explanation it would be much appreciated. • Have you tried working out the count of variable names for a couple characters, say,$1,2,3,4,\dots$characters in length? – abiessu Apr 25 '18 at 2:25 1 Answer Hint: Do you recognize the exponent on$r\$ as the number of characters after the first? How many one character names are there? What does that represent?

• That makes sense. If the string has only one character, there are 54 possibilities since the first character must not be a digit. If the string has two characters, there are 54 * 64 possibilities and so on. So would the geometric series be 54 * 1 * (64^65535 - 1) / (64 - 1) equaling 54 * (64^65535 - 1) / 63? – John Larkos Apr 25 '18 at 2:57
• That is correct. – Ross Millikan Apr 25 '18 at 3:03