In the api document of Java 5.0, the equals() func is described as:
"public boolean equals(Object obj)Compares this object to the specified object. The result is true if and only if the argument is not null and is an Integer object that contains the same int value as this object. "
However, result of the following code is
Integer i = new Integer(42); Integer j = new Integer(42); System.out.println(i.equals(j)); System.out.println(i.equals(42));
Because the equals method is expecting some sort of object (not a primitive) as an argument, the int literal 42 is automatically converted to an instance of Integer. This is a process called "boxing" or "autoboxing."
See this Autoboxing article for more details. [ June 12, 2006: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org