【发布时间】:2017-02-26 09:46:10
【问题描述】:
我看到了您可以使用charAt() 方法进行的各种比较。
但是,我真的不能理解其中的一些。
String str = "asdf";
str.charAt(0) == '-'; // What does it mean when it's equal to '-'?
char c = '3';
if (c < '9') // How are char variables compared with the `<` operator?
任何帮助将不胜感激。
【问题讨论】:
-
“等于'-'是什么意思?”不是线索,只有那个代码的创建者可能知道...
-
"char 变量与
<运算符相比如何?" 原语char是一个numeric 类型,因此可以与@ 进行比较987654325@或<
标签: java char comparison charat