Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding the "cannot find symbol" error

Tags:

java

What is this error?

cannot find symbol, symbol: method getstring(java.lang.String) 
Location: class InternalFrameDemo 
if <!windowTitleField.getText().equals(getstring("InternalFrameDemo.frame_label")))

2 Answers

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)

like image 148
Cristian Sanchez Avatar answered Jan 22 '26 14:01

Cristian Sanchez


it means that the class InternalFrameDemo has no getstring() method - shouldn't that be "getString" with an uppercase "S"?

like image 30
Draemon Avatar answered Jan 22 '26 14:01

Draemon