equality and identity in javaif you're talking about primitive typesthe equality operator (==will tell you whether two variables have the same valueint intvar int intvar intvar if(intvar =intvar system out println("they're equal")this is the same as the syntax in and ++but in javabecause relational operators use referencesthey work differently with objects the equality operatorwhen applied to objectstells you whether two references are identical--that iswhether they refer to the same objectcarpart cp new carpart("fender")carpart cp cp if(cp =cp system out println("they're identical")in +this operator would tell you if two objects contained the same data if you want to see whether two objects contain the same data in javayou must use the equals(method of the object classcarpart cp new carpart("fender")carpart cp cp ifcp equals(cp system out println("they're equal")this technique works because all objects in java are implicitly derived from the object class overloaded operators this point is easythere are no overloaded operators in java in ++you can redefine +*=and most other operators so that they behave differently for objects of particular class no such redefinition is possible in java use named method insteadsuch as add(or whatever primitive variable types the primitive or built-in variable types in java are shown in table