Max name length of variable or method in Java

前端 未结 3 1917
春和景丽
春和景丽 2020-12-05 22:48

Is there a max length for class/method/variable names in Java? the JLS doesn\'t seem to mention that. I know very long names are problematic anyway from code readability and

3条回答
  •  伪装坚强ぢ
    2020-12-05 23:26

    If you go over the size limit imposed by the VM for method names then you get a compiler error (at least with the version of javac I am using):

    Main.java:1: UTF8 representation for string "aaaaaaaaaaaaaaaaaaaa..." is too long for the constant pool

提交回复
热议问题