了解“找不到符号” 错误
这是什么错误?
cannot find symbol, symbol: method getstring(java.lang.String)
Location: class InternalFrameDemo
if <!windowTitleField.getText().equals(getstring("InternalFrameDemo.frame_label")))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Java 区分大小写。 由于“getstring”不等于“getString”,编译器认为“getstring”方法在InternalFrameDemo 类中不存在,并返回该错误。
在Java中,方法通常在第一个单词大写之后每个单词的第一个字母(例如toString(),toUpperCase()等),类将使用Upper Camel Case(例如 ClassName、String、StringBuilder)和常量全部大写(例如 MAX_VALUE)
Java is case-sensitive. Because "getstring" is not equal to "getString", the compiler thinks the "getstring" method does not exist in the InternalFrameDemo class and throws back that error.
In Java, methods will generally have the first letter of each word after the first word capitalized (e.g. toString(), toUpperCase(), etc.), classes will use Upper Camel Case (e.g. ClassName, String, StringBuilder) and constants will be in all caps (e.g. MAX_VALUE)
这意味着类InternalFrameDemo没有getstring()方法——不应该是带有大写“S”的“getString”吗?
it means that the class InternalFrameDemo has no getstring() method - shouldn't that be "getString" with an uppercase "S"?
可能是说 InteranlFrameDemo 中没有名为 getstring 的方法接受 String 参数。 该方法可能应该是 getString("mystring") 吗?
java中方法名称区分大小写,这就是我猜测的原因
Maybe it's saying that there isn't a method in InteranlFrameDemo called getstring that takes a String argument. Possibly is the method supposed to be getString("mystring")?
method names are case-sensitive in java, which is why I'm guessing this
也许 getstring() 应该是 getString()?
基本上它是说InternalFrameDemo没有getstring()方法。
Perhaps getstring() should be getString()?
Basically it is saying InternalFrameDemo has no getstring() method.
只是因为Java 是区分大小写的。 尝试 getString() 而不是 getstring()。 Java一般使用Camel表示法。
It's just because Java is case sensitive. Try getString() instead of getstring(). Java generally uses Camel notation.