jaco hoff

Greenhorn
+ Follow
since Apr 21, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jaco hoff

so
Integer i1 = 5;
Integer i2 = 5;
System.out.println(i1 == i2);
returns true.
and

Integer i1 = new Integer(5);
Integer i2 = new Integer(5);
System.out.println(i1 == i2);
returns false.

Nasty little details. Thanks for the replies
16 years ago
I think I may have found an error in the cow roundup. I forgot the question number though, so I can't look it up again. The question was if 2 Integers with value 5 are '=='. The correct answer is yes. Shorts and Integers with a value between -128 and 127 are considered '==', even if they are different objects. With another value they are not '==', but are 'equals'. (Not good English, but I think you know what I mean).
Can someone please confirm if that question was incorrect?
16 years ago