“Char can not dereferenced”错误 [英] "Char cannot be dereferenced" error
问题描述
我想使用char方法 isLetter()
,它应该返回对应于字符是否为字母的布尔值。但是当我调用该方法时,我得到一个错误,指出char不能被dereferenced。我不知道解除引用char或如何解决错误的意思。该语句是:
I'm trying to use the char method isLetter()
, which is supposed to return boolean value corresponding to whether the character is a letter. But when I call the method, I get an error stating that "char cannot be dereferenced." I don't know what it means to dereference a char or how to fix the error. the statement in question is:
if (ch.isLetter())
{
....
....
}
任何帮助?
推荐答案
类型char是一个原始类型 - 不是
The type char is a primitive -- not an object -- so it cannot be dereferenced
取消引用是访问引用引用的值的过程。由于char已经是一个值(不是引用),因此无法取消引用。
Dereferencing is the process of accessing the value referred to by a reference. Since a char is already a value (not a reference), it can not be dereferenced.
使用 Character
:
if(Character.isLetter(c)) {
这篇关于“Char can not dereferenced”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!