I don't completely understand your question, but in your example pkgType would have to be the name of a class (which you should actually capitalize) and the name of a member variable in that class. You have a return value in the case this.pkgType == that.pkgType, but no return value if they aren't equal. That would cause a compile error, which ...