Java.Variable name length

后端 未结 4 1506
被撕碎了的回忆
被撕碎了的回忆 2021-01-28 01:11

in documentation i read, that:

A variables name can be any legal identifier — an **unlimited-length** sequence of Unicode letters and digits

so

4条回答
  •  渐次进展
    2021-01-28 02:02

    1) I wouldn't be surprised if some compiler implementations had (reasonable) limits while others could handle variable names of any length. Unfortunately, I don't know of any documented specific examples or have any specific experiences of either off-hand.

    2) Local variables names don't have to be maintained in the class file (they aren't accessible via reflection). Try making a file with an instance variable name that long and see the resulting class file.

提交回复
热议问题