Hi All,
From what I understand, only the
String and Wrapper classes override the equals() method, then why does the following code evaluates 'if' statement to true.
import java.util.*;
public class EqualsTest
{
public static void main(String[] args) {
Integer i = new Integer(10);
Vector v = new Vector();
LinkedList l = new LinkedList();
v.add(i);
l.add(i);
if (v.equals(l))
System.out.println("They are equal");
else
System.out.println("They are Not equal");
}
}
Thanks:
Namita