Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Communication Patterns: A Guide for Developers and Architects
this week in the
Design and Architecture
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Programmer Certification (OCPJP)
HashMap StackOverflowError problem - please explain me
Abdul Mohsin
Ranch Hand
Posts: 111
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Predict the result !!! and please explain me
HashMap map= new HashMap();
map.put(map,"abdul");
System.out.println(map.get(map));
Regards,
Abdul Mohsin
[ May 18, 2007: Message edited by: Abdul Mohsin ]
Regards, Abdul Mohsin
Chandra Bhatt
Ranch Hand
Posts: 1710
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
See the links:
One
Second
Thanks,
cmbhatt
Abdul Mohsin
Ranch Hand
Posts: 111
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi Chandra,
thanks for these links but my question is why the above code is giving
StackOverflowError
Regards,
Abdul Mohsin
Regards, Abdul Mohsin
Mirko Bonasorte
Ranch Hand
Posts: 244
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The problem is the AbstractMap.hashCode(), which uses the hashCode keys to build it. If the keys contains itself, you have an infinite loop.
Abdul Mohsin
Ranch Hand
Posts: 111
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I just gone through the AbstractMap
java
doc
,but still its not clear why its going in infinite loop.
Regards,
Abdul Mohsin
Regards, Abdul Mohsin
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
ClassCast exception
Guess the answer and please explain
Doubt pertaining to '==' operator
Question regex
Collections
More...