SyntaxFix
Write A Post
Hire A Developer
Questions
You can't compare object data like this:s1.getParent() == s2 - this will compare the object references. You should override equals function for Foo class and then compare them like this s1.getParent().equals(s2)
s1.getParent() == s2
equals function
s1.getParent().equals(s2)