Is it possible to have same hashcode for different strings using java\'s hashcode function?or if it is possible then what is the % of its possibility?
The percentage of collisions for random strings should be minimal. However, if you hash strings from external sources, an attacker could easily create hundreds of thousands of strings having the same hashcode. In a java HashMap these would all map to the same bucket and effectively turn the map into a linked list. Access times to the map would then be proportional to the map size instead of constant, leading to a denial of service attack.
See this page on Effective DoS attacks against Web Application Plattforms for further information links to the presentation.