Math, asked by kalaialphonse, 1 year ago

Difference between equality and identity in maths

Answers

Answered by preranaupadhyay742
0

identity: a variable holds the same instance as another variable.

equality: two distinct objects can be used interchangeably. They often have the same id.

E.g:

   Integer a = new Integer(100);

   Integer b = a;

a is identical to b.

   Integer c =  new Integer(100);

   Integer d = new Integer(100);

c is equal but not identical to d.

Of course, two identical variables are always equal.

Similar questions