I would imagine it was just an oversight. Remember the curious fact that the oldest classes in the Java APIs were written by people who had no experience at all writing in Java!
Originally posted by Ernest Friedman-Hill: I would imagine it was just an oversight. Remember the curious fact that the oldest classes in the Java APIs were written by people who had no experience at all writing in Java!
And apparently also not in other OO languages... :roll:
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
pascal betz
Ranch Hand
Joined: Jun 19, 2001
Posts: 547
posted
0
but StringBuilder (added in 1.5) also does not override equals()...
any other reasons (appart from "just forgotten") ?
cheers
pascal
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
posted
0
Originally posted by pascal betz: but StringBuilder (added in 1.5) also does not override equals()...
They probably wanted it to be as compatible to StringBuffer as possible...
Originally posted by Chinmay Bajikar: Hi, Have a look at this code snippet,
What should ideally happen? I didnt find any equals() implementation in the StringBuffer class. I am using JDK 1.4.2.
Answer ------
== symbols used to compare the content(string)in a object. but .equals()method is used to compare the string or stringbuffer object; so sbuf,dbuf or different object, so that the result is sbuf!=dbuf
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
posted
0
Originally posted by bala rajesh: == symbols used to compare the content(string)in a object. but .equals()method is used to compare the string or stringbuffer object; so sbuf,dbuf or different object, so that the result is sbuf!=dbuf
Huh? For StringBuffer objects, == and equals() do exactly the same thing, because StringBuffer doesn't override equals() (in contrast to String). The original poster asked about the reasoning for this, and I think the previous responses were right on mark. Therefore your responses confuses me quite a bit...
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.