当Java(解释器)区分大小写时,为什么Java编译器(javac)不区分大小写? [英] Why is the Java compiler (javac) case-insensitive when java (the interpreter) is case-sensitive?

查看:111
本文介绍了当Java(解释器)区分大小写时,为什么Java编译器(javac)不区分大小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行Java程序时,我注意到Java编译器对于文件名不区分大小写,而Java解释器则区分大小写.

When I was executing a Java program I noticed that the Java compiler is case-insensitive with respect to file names whereas the Java interpreter is case-sensitive.

Java解释器区分大小写是非常容易理解的,因为类文件的名称就是Java代码中定义的类的名称.

The Java interpreter being case-sensitive is very much understandable as, the name of the class file is the name of the class defined in the Java code.

Java编译器不区分大小写是否有充分的理由?

Is there any good reason for the Java compiler being case-insensitive?

推荐答案

Windows文件系统不区分大小写.
您不能(敏感地)在不区分大小写的文件系统上找到区分大小写的文件.

The Windows filesystem is case-insensitive.
You cannot (sanely) find a case-sensitive file on a case-insensitive filesystem.

如果在具有区分大小写的文件系统的Linux上运行javac,它将区分大小写.

If you run javac on Linux with a case-sensitive filesystem, it will be case-sensitive.

这篇关于当Java(解释器)区分大小写时,为什么Java编译器(javac)不区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆