Is there a point to these rules?
Asked
Active
Viewed 4,208 times
2 Answers
14
Each file inside folder is translated into java field name inside R.java class:
drawable\icon.png -> R.drawable.icon
Hence the reason for not using special characters inside file names, as they can no be used in Java names.
As for capital letters, I guess that's to avoid one little problem in Windows vs. Linux environment. That's because Linux thinks that Icon.png
and icon.png
are different files, and Windows thinks that Icon.png
and icon.png
is the same file. So anyone using Linux can create application that is not compilable on Windows.

inazaruk
- 74,247
- 24
- 188
- 156
-
I don't think that's true. Java stores Strings internally in UTF-16. You can even code your Java apps in Mandarin if you fancy doing so. – mxk Jul 20 '11 at 07:23
-
What Strings and UTF-16 has to do with file names and special symbols in file names? – inazaruk Jul 20 '11 at 08:10
-
I was referring to the "Hence the reason for not using special characters inside file names, as they can no be used in Java names." statement. That's simply not true. You can use all sorts of special characters in Java identifiers. – mxk Jul 20 '11 at 12:41
-
Yeah and I just realized my comment didn't make any sense. I actually meant Java identifiers, not values stored as String types. – mxk Jul 20 '11 at 12:42