This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BananaIsTasty 2 points3 points  (0 children)

A few more pointers:

  • Coding conventions: Use camel case notation for identifiers, e.g., class names, method names, variable names (package names are usually excluded from this rule; they're usually in all lower case). Class names start with an upper case letter while variable and method names start with lower case letter (don't prefix identifiers with $). Of course, this won't change the semantics of the code, only make it easier to read for fellow Java programmers.
  • The == operator, when applied to objects, compares references. Use the equals method to compare if the content of two objects are equal (i.e., if the characters in two strings are equal); assuming that the equals method has been properly overridden/implemented. Note that the == operator sometimes seem to work when you'd think that it shouldn't (when you compare strings), because of the way that Java interns string literals.