Can I name my java source code file with a number? -


this question has answer here:

i'm saving source code java textbook exercises , realise have compilation error whenever save file using names " 2-15.java" along "public class 2-15" in source code

is there way can name starting number or profited in java?

from the language spec:

an identifier unlimited-length sequence of java letters , java digits, first of must java letter.

"letters":

"java letters" include uppercase , lowercase ascii latin letters a-z, , a-z, and, historical reasons, ascii underscore (_) , dollar sign ($).

"digits":

the "java digits" include ascii digits 0-9


your example fails because first character not "java letter" , dash not "java letter".

further, convention class names use uppercamelcase (also called 'pascalcase'), though not strictly required language.

some people argue shouldn't use digits @ in class names disagree this. can result in more readable names otherwise possible. example: aspectratio16x9 vs aspectratiosixteenbynine


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -