这个问题我想了很久: 我们可以使用类型名称作为变量名称吗?
例如,REST api 上的某个人将其变量之一称为“ protected ”,有没有办法获取它?我正在开发一个Android应用程序,api返回Json对象。为了加速这个过程,我使用了 Gson 库。
最佳答案
其中提到in the Docs已经这样了
You cannot use any of the following as identifiers in your programs.
programmers cannot use keywords as names for variables, methods, classes, or as any other identifier.2
如果您仍然想使用它们,请在该名称中添加下划线或一些额外的字母。
关于java - 我们可以使用类型名称作为变量吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17250548/