Case sensitivity of Java class names

前端 未结 3 953
天涯浪人
天涯浪人 2020-12-04 16:45

If one writes two public Java classes with the same case-insensitive name in different directories then both classes are not usable at runtime. (I tested this on Windows, Ma

3条回答
  •  难免孤独
    2020-12-04 17:14

    Donal's fine explanation leaves little to add, but let me briefly muse on this phrase:

    ... Java classes with the same case-insensitive name ...

    Names and Strings in general are never case-insensitive in themselves, it's only there interpretation that can be. And secondly, Java doesn't do such an interpretation.

    So, a correct phrasing of what you had in mind would be:

    ... Java classes whose file representations in a case-insensitive file-system have identical names ...

提交回复
热议问题