volume_mute

Names in Java have no length limit

publish date2022/06/02 03:22:00 GMT+10

volume_mute

Correct Answer

True

Explanation

In Java, identifiers such as variable names, method names, and class names do not have a hard, fixed length limit imposed by the language specification itself.  However, the Java Virtual Machine (JVM) and the class file format have limitations on the size of constant pool entries, which store names, descriptors, and other string values. Specifically, the length of field and method names, descriptors, and other constant strings is limited to 65,535 bytes in UTF-8 encoding. This means that while you can theoretically have a very long name, it cannot exceed this byte limit when compiled into bytecode.

Reference

Concepts of Programming languages, 10th ed


Quizzes you can take where this question appears