Cecilia Burman

Greenhorn
+ Follow
since Jan 25, 2010
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 Cecilia Burman

My mistake I did not realize the difference between "=0" and "=new Integer(0)"

Thank you for explaining. I will be careful to copy the exact code next time I test a question.

/Cecilia
13 years ago
I also found this question:
(#98) All exceptions ingerit from:
With the explanation:
"The Exception hierarchy begins at java.lang.Throwable"
IMHO all exceptions inherit from both Throwable and Exception. Isn't that so?

:-)
/Cecilia
13 years ago
The discussion you refer to is exactly what I mean. Since the value (5) is lower than 127, the real answer is true, not false
13 years ago
Hi

I just rounded up some cattle at The JavaRanch Rules Round-up Game. I noticed the following question:
(#16) Integer a=new Integer(5); Integer b = new Integer(5); What is the result of running if (a==b)
The real answr is true, not false
The Integer (maybe most wrapper classes) is an exception to the rule stated in the explanation. It does return true for low numbers as the following code-snippet shows:



Kind Regards, Cecilia

13 years ago
As long as your object inherits from Object, there must be an equals() method unless I'm much mistaken.
14 years ago