• Post Reply Bookmark Topic Watch Topic
  • New Topic

class name  RSS feed

 
Sainudheen Mydeen
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Is there any limit on the number of characters in a class name?
-Sainudheen
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know of any limit imposed by the JVM/Javac compiler. (That's not to say that there may not be one, that's jsut saying that I'm not aware of it...)
But since the JVM requires the .class files to be in files, you are limited by the length of the file name on the OS, which (I think) is somewhere in the hundreds of characters (255 maybe? I'm not sure what OSes support these days).
Not that that really matters; if your class names are longer than about 25 characters, you should be thinking about revising your naming scheme....
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OS do limit the size of file names.
You can read the section 3.8 Identifiers of JLS.
 
Sainudheen Mydeen
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joel and Pradeep
I am sure I will not go to that extreme to name my class. I am trying to figure out whether java maintain any restriction on this.
Thanks
-Sainudheen
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!