190k views
1 vote
Which of the following is a legal variable name in Java?

make.use
other_var
else
else is a reserved word in Java, used in conditional statements, so it cannot be a variable name.
alt name

Which of the following is a legal variable name in Java? make.use other_var else else-example-1
User Nicofisi
by
6.5k points

1 Answer

4 votes

Answer:

The answer is "other_var".

Step-by-step explanation:

In java programming language the variable name must be Case-sensitive, and it uses unlimited pattern, beginning from a letter, of Unicode letters and digits, the "$" sign and the underscore " _", and the incorrect choice can be defined as follows:

  • In choice "make.use", it is wrong because it does not use "."
  • In choice "else", it is wrong because it is a keyword.
  • In choice "alt name ", it is wrong because it uses the space, which is not allowed.
User Rspeed
by
6.8k points