Difference between == and equals
using == on primitive data types is not the same as using it on object reference data types.
- On primitive data types
== is used as equals.
- for object reference data types
== refers to their references. Thus
what the object points to in memory.
Consider case 1
double d1 = 10.00;
double d2 =10.00;
System.out.println(d1 == d2);
*output is * true

case 2: == reference data types
Double d1 = 10.00;
Double d2 =10.00;
System.out.println(d1 == d2);
*output is * false

d1 and d2 have different memory references.
to check the validity of this consider the following code
Double d1 = 10.00;
Double d2 = d1;
System.out.println(d1 == d2);
This will print true since d1 and d2 point to the same memory reference.
Therefore
Java uses == to compare primitives and for checking if two variables refer to the same object
`equals'
is used for checking if two objects are equivalent.
it also depends on the implementation of the object it is being called on. For Strings, equals() checks the characters inside of it.
Double d1 = 10.00;
Double d2 = 10.00;
System.out.println(d1.equals(d2));
prints true since it looks what's inside the d1 and d2.
case 1 will not compile
