When comparing two strings to check if they are equal in java you should use equals ().
In your case, you should change the comparison line to
if(path.equals("car"))
In java, equals () compares the actual contents of your lines, while == will only compare to see if the two links are equal
source
share