java 区分大小写

Java is a case-sensitive language, which means that the upper or lower case of letters in your Java programs matter.

Java是区分大小写的语言,这意味着Java程序中字母的大小写很重要。

关于区分大小写 ( About Case Sensitivity )

Case sensitivity enforces capital or lower case in the text. For example, suppose you have created three variables called "endLoop", "Endloop", and "EndLoop". Even though these variables are composed of the exact same letters in the same exact order, Java does not consider them equal. It will treat them all differently.

区分大小写在文本中强制使用大写或小写。 例如,假设您创建了三个变量,分别称为“ endLoop”,“ Endloop”和“ EndLoop”。 即使这些变量以完全相同的顺序由完全相同的字母组成,Java也不认为它们相等。 它将以不同的方式对待他们。

This behavior has its roots in the programming language C and C++, on which Java was based, but not all programming languages enforce case sensitivity. Those that do not include Fortran, COBOL, Pascal, and most BASIC languages.

此行为起源于Java所基于的编程语言C和C ++,但并非所有编程语言都强制区分大小写。 不包含Fortran,COBOL,Pascal和大多数BASIC语言的语言。

区分大小写的理由 ( The Case For and Against Case Sensitivity )

The "case" for the value of case sensitivity in a programming language is debated among programmers, sometimes with an almost religious fervor.

在编程语言中,区分大小写的价值的“大小写”在程序员之间争论不休,有时是出于宗教上的热情。

Some argue that case sensitivity is necessary to ensure clarity and accuracy — for example, there is a difference between Polish (being of Polish nationality) and polish (as in shoe polish), between SAP (an acronym for System Applications Products) and sap (as in tree sap), or between the name Hope and the feeling hope. Further, the argument goes, a compiler should not try to second-guess the intent of the user and should rather take strings and characters exactly as entered, to avoid unnecessary confusion and introduced errors.

有人认为,区分大小写对于确保清晰度和准确性是必要的,例如,波兰语(属于波兰国籍)和波兰语(如鞋油),SAP(系统应用产品的缩写)和sap(如树液),或在希望和感觉希望之间。 此外,争论的焦点是,编译器不应试图再次猜测用户的意图,而应准确输入所输入的字符串和字符,以避免不必要的混乱和引入的错误。

Others argue against case sensitivity, citing that it is harder to work with and more likely to result in mistakes while providing little gain. Some argue that case-sensitive languages negatively impact productivity, forcing programmers to spend untold hours debugging issues that end up as simple as the difference between "LogOn" and " logon."

其他人则反对区分大小写,理由是这种做法更难处理,更容易导致错误,同时却几乎没有收益。 一些人认为,区分大小写的语言会对生产率产生负面影响,迫使程序员花费大量时间来调试问题,而这些问题的解决之道就像“登录”和“登录”之间的区别一样简单。

The jury is still out on the value of case-sensitivity and it may be able to pass final judgment. But for now, case sensitivity is here to stay in Java.

陪审团仍不区分大小写,可以通过最终裁决。 但是就目前而言,区分大小写在Java中仍然存在。

使用Java的区分大小写的技巧 ( Case Sensitive Tips for Working in Java )

If you follow these tips when coding in Java you should avoid the most common case sensitive errors:

如果使用Java进行编码时遵循这些提示,则应该避免最常见的区分大小写的错误:

  • Java keywords are always written in lowercase. You can find the full list of keywords in the reserved words list.

    Java关键字始终以小写形式编写。 您可以在保留字列表中找到关键字的完整列表 。

  • Avoid using variable names that differ only in case. Like the example above, if you had three variables called “endLoop”, “Endloop”, and “EndLoop” it would not take long before you mistype one of their names. Then you might find your code changing the value of the wrong variable by mistake.避免使用仅大小写不同的变量名。 像上面的示例一样,如果您有三个名为“ endLoop”,“ Endloop”和“ EndLoop”的变量,那么不久您就可以输错它们的名称之一。 然后,您可能会发现代码错误地更改了错误变量的值。
  • Always make sure the class name in your code and java filename match.始终确保代码中的类名和Java文件名匹配。
  • Follow the Java naming conventions. If you get into the habit of using the same case pattern for different identifier types, then you improve your chances of avoiding a typing mistake.

    遵循Java命名约定 。 如果您习惯对不同的标识符类型使用相同的大小写模式,则可以避免输入错误。

  • When using a string to represent the path of a file name, i.e. "C:\JavaCaseConfig.txt" make sure you use the right case. Some operating systems are case insensitive and don't mind that the filename isn't exact. However, if your program is used on an operating system that is case sensitive it will produce a runtime error.当使用字符串表示文件名的路径时,即“ C:\ JavaCaseConfig.txt”,请确保使用正确的大小写。 某些操作系统不区分大小写,并且不介意文件名不正确。 但是,如果您的程序在区分大小写的操作系统上使用,则会产生运行时错误。

翻译自: https://www.thoughtco.com/java-is-case-sensitive-2034197

java 区分大小写

java 区分大小写_Java区分大小写相关推荐

  1. java中大小写区分大小写_Java区分大小写吗?

    8 个答案: 答案 0 :(得分:34) 我在某处读到Java区分大小写.我无法证实这一点. Java源代码区分大小写,如果您的意思是.即Double与double的类型不同,您可以有两个不同的独立变 ...

  2. java源程序中区分大小写_Java程序中不区分大小写字母。( )_学小易找答案

    [单选题]下列选项中,不属于Java语言特点的一项是( ) [单选题]丝绸时髦了,人造纤维过时了. [单选题]<葛生>出自<诗经>的: [多选题]keyshot渲染的光源是利用 ...

  3. java 标识符_java标识符是什么

    在Java语言中,对于变量,常量,函数,语句块的名字,我们统统称之为Java标识符.下面来和小编一起详细了解一下吧. Java语言中,对于变量,常量,函数,语句块的名字,我们统统称之为Java标识符. ...

  4. c如何接收java指令_java指令和javac指令总结

    假如在D:\Java存放了两个java源文件:MyJava.java,Fighting.java MyJava.java如下: public class MyJava { public static ...

  5. 【源码+教程】Java课设项目_12款最热最新Java游戏项目_Java游戏开发_Java小游戏_飞翔的小鸟_王者荣耀_超级玛丽_推箱子_黄金矿工_贪吃蛇

    马上就要期末了,同学们课设做的如何了呢?本篇为大家带来了12款热门Java小游戏项目的源码和教程,助力大家顺利迎接暑假![源码+教程]Java课设项目_12款最热最新Java游戏项目_Java游戏开发 ...

  6. 黑马程序员全套Java教程_Java基础教程_异常(含扩展)(二十三)

    黑马程序员全套Java教程_Java基础教程_异常(含扩展)(二十三) 1.1 异常概述与异常体系结构 1.2 JVM遇到异常时的默认处理方案 1.3 异常处理 1.4 异常处理之try--catch ...

  7. java包含不区分大小写_Java不区分大小写。

    [单选题]在常用螺纹类型中, 主要用于传动的是 . [单选题]在<现代汉语词典>中,查阅"间或一轮"中"间"的读音和意义,说法正确的一 项是( ) ...

  8. java标识符区分大小写_java标识符区分大小写怎么区分?Java入门教程

    在Java中,标识符的规则区分与C语言语言是极其严格的,写错程序就会爆红,下面我们就来了解一下Java中举报的标识符规则吧. 标识符指程序中用来标识某个实体的一个符号,不同环境下的标识符有不同的意义. ...

  9. java变量-是否区分大小写?

    为什么80%的码农都做不了架构师?>>>    严格区分大小写! ----------- 参考文章: 1. java中包名.类名是不区分大小写的,也就是说包名:com.wang 和c ...

  10. Java不区分大小写模糊查询方法_查询语句中不区分大小写和区分大小写及其模糊查询 的语句...

    1:不区分大小写的函数 collate Chinese_PRC_CI_AS select * from J01 left join S40 on J0101=S4004 collate Chinese ...

最新文章

  1. 最快捷的Linux命令查询工具来了:「我该怎么做XX」,一句话自动返回操作指南...
  2. [MATLAB学习笔记]sprintf将数据格式化为字符串或字符向量
  3. 通过javascript改变form提交的action,实现不同的按钮向不同的action提交同一个form的数据
  4. QT实现maroon游戏
  5. 在windows 实现执行 makefile
  6. python qq聊天机器人_Python QQBot库的QQ聊天机器人
  7. ByteBuffer分散和聚集的应用场景
  8. word,excel转pdf
  9. XL4001 典型应用电路
  10. 台式机设成仅计算机,将台式机更改为笔记本,将笔记本电脑更改为台式机
  11. Cell Host | 张群业/王哲/张澄-肠道微生物群失调加重腹主动脉瘤
  12. Kotlin版注解处理器Annotation Processor
  13. Log与logcat
  14. 初识 GitHub · 简介篇
  15. Jrebel、IDEA的激活与Springloaded使用
  16. AI面部修复项目:GFP-GAN
  17. RabbitMq消息中心_延迟发送消息
  18. android 点击查看大图_你是不是遇到,在花瓣网部分图片详情页,点击“放大镜”无法预览高清大图?...
  19. matlab 旋转曲面,在matlab中实现旋转曲面的动画设计
  20. 恒大研究院|中国最具发展潜力的100个城市

热门文章

  1. Android 垃圾分类APP(三)垃圾分类之语音输入
  2. Redis深度历险——原理与集群篇
  3. 山西好点的计算机专科学校排名及分数线,2019山西十大专科学校排名及高考录取分数线...
  4. LabVIEW:忽略自动错误处理
  5. SONiC(3):手动运行docker ptf
  6. 杨国福和张亮“天地对决” 麻辣烫江湖要变天了吗?
  7. WPF窗口属性设置(无边框,任务栏隐藏图标,任务管理器应用程序隐藏图标)
  8. android ps4 远程,手机上玩PS4游戏!Remote Play扩大至所有Android设备
  9. 如何避免前人挖坑,后人填坑
  10. 网站在线工具查询链接收录与优化文章收录情况