Java – the declaration of variable name declares the type of value to be stored? A prank?

Therefore, I have this true / false question in my computer science class (we use Java):

(the word "type" in the question is bold)

Now, I know that when you declare a variable, you must specify the type in Java because it is statically typed:

int x;

In this code, a variable named x is declared, and we know that its type is int

However, the question refers to the term "variable name" Technically, the name / identifier of a variable is not responsible for declaring the type of the variable If the programmer chooses, the name does not even need to mention the type of variable

I want to know that there is the right choice here Is this true or false? It seems vague to me... What should I do?

Solution

The problem is specific: "Declaration of variable name..." (emphasize my)

If it says "variable name declaration..." you may be right to assume that this is a technical problem However, since the question is specific to the declaration itself, the correct answer is correct

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>