
Java Error - Cannot Find Symbol
Java Error - Cannot Find Symbol
In this video, I’ll show you how to resolve a java error “canott find symbol” when you try to compile, this video will help you get up and running quickly.
This is a compilation error.
The error cannot find symbol simply means the compiler cannot find the reference to an identifier usually due to a typo or you just reference to something that does not exist.
#javaprogrammingtutorial
#javaforbeginners
#tookootek
Content
3 -> Hey Everyone!
4.125 -> The error cannot find symbol simply means
6.916 -> the compiler cannot find the reference to an identifier
9.666 -> usually due to a typo or you just reference to something that does not exist
13.791 -> for example in this scenario
15.916 -> I have a typo in class name, I use Products instead of Product
19.375 -> that is why the compiler cannot find it
21.708 -> the class name should be Product
23.5 -> It is a simple fix, you just need to use the correct identifier
26.583 -> in this case, rename it to Product.
28.166 -> save it and recompile
31.25 -> there you go, no compilation error.
34.166 -> you might encounter this error as well in variables. Let me show you.
38.125 -> say you will print this variable in console or Terminal
41.666 -> lets compile and see
45.166 -> alright, you got the error as well
49.458 -> because variable result was not declared yet
52.833 -> so to fix it, lets declare the variable and lets assign a value while we are at it
56.791 -> assign it as String
60.875 -> and with value "Hello World!"
63.416 -> save it and compile
64.791 -> see, no error. Now run it.
68.541 -> Alright, It run successfully without error.
71.083 -> we got our Hello World!
72.083 -> allright! Thank you for watching!
Source: https://www.youtube.com/watch?v=HWcgCnIoRMs