If you compare two Strings in a case insensitive
way,
e.g. with String.compareToIgnoreCase,
then they are considered equal if they differ only in capitalisation.
Java, the language, is case sensitive
.
Capitalisation must be precise in class, method and variable names. avar
is not the same variable as aVar. However, the
underlying operating system may be case insensitive, e.g. Windows. To Java, MyApp.
class and Myapp. class
are totally different files, but to Windows they are the same. To avoid problems,
never name two different classes (or any other entities for that matter) with
names differing only in capitalisation. The one possible exception is to name a
local variable the same as its class, with the leading cap change to lower case,
e.g. MyApplet myApplet = new
MyApplet(); The OS never sees these local
variable names.
Resources, resource bundles, jar members generally and images all need the correct capitalisation. Again for safety, file names should be correct too, though Windows permits sloppiness.
| You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | |
| http://mindprod.com/jgloss/casesensitive.html | J:\mindprod\jgloss\casesensitive.html | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.191.104] | |
| Feedback | You are visitor number 18,299. | |