I'm trying to add a function to my server's code that checks the game version given in the packet that contains the username against the server's game version. Even though the Strings appear to be exactly identical, an "if(connectionPacket.version == Display.version)" function returns false. Why is this? Is there a way to fix this?

Thanks, I didn't think it was too complicated, i just was very confused.

It's a nuance of Java that often takes a bit for coders from c/c++ and others to get the hang of. Everything is a pointer, basically, except primitives. Also there is no operator overloading, so comparisons always compare pointer values for everything that is not a primitive, thus the compareTo and equal methods are usually employed to compare the stuff in the objects you create, such as String. Just remember, if it's a class then operators will effect the pointer, so look for the comparison methods. You can overload equal and if you implement the comparator interface you can add a compareTo as well, which is really helpful in sorting.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org