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
Getting started with Java on the Raspberry Pi
this week in the
Raspberry Pi
forum!
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
Tim Cooke
Jeanne Boyarsky
Sheriffs:
Rob Spoor
Devaka Cooray
Liutauras Vilda
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Piet Souris
Forum:
Programmer Certification (OCPJP)
String equvalence....
Amit Das
Ranch Hand
Posts: 206
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi all,
plz refer the code below:
public class MyClass { public static void main (String args[]) { StringBuffer strbuf = new StringBuffer("SCJP"); StringBuffer strbuf1 = new StringBuffer ("SCJP"); System.out.println(strbuf.hashCode() == strbuf1.hashCode() ); } }
Kalyani Marathe
Ranch Hand
Posts: 72
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
First of all StringBuffer doesn't override equals method. Also if you try to
print the hashcodes you will get diff values:
System.out.println(strbuf.hashCode() +" "+ strbuf1.hashCode() );
Thanks
Jim Yingst
Wanderer
Posts: 18671
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Looks like two copies of this were posted. Followups
here
please.
"I'm not back." - Bill Harding,
Twister
What a stench! Central nervous system shutting down. Save yourself tiny ad!
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
String & String Buffer
Equality of String objects
overriding private methods
Object
static ?
More...