This question came up in Spring class, which has some rather long class names. Is there a limit in the language for class name lengths?
The specification of the programming language states that the length of a Java class name is unlimited. In practice, however, the first limit comes from the JVM specification. For the current JVM it's 65535 characters.
A class name is an identifier—a series of characters consisting of letters, digits, underscores ( _ ) and dollar signs ( $ ) that does not begin with a digit and does not contain spaces. Some valid identifiers are Welcome1 , $value , _value , m_inputField1 and button7 .
Java class names cannot start with numbers.
You shouldn't use predefined or existing class names as the name of the current class. You shouldn't use any Java keywords as class name (with the same case). The First letter of the class name should be capital and remaining letters should be small (mixed case).
The Java Language Specification states that identifiers are unlimited in length.
In practice though, the filesystem will limit the length of the resulting file name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With