This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes == operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "== operator" Watch "== operator" New topic
Author

== operator

Soum Sark
Ranch Hand

Joined: May 31, 2002
Posts: 50
What are the general rules governing the use of the == operator. I notice we cannot compare
String == StringBuffer . Why is this. Do the objects on both sides have to be in some sort of hierarchy ?
thanx
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
You guessed it!
from ]JLS 15.23.3

A compile-time error occurs if it is impossible to convert the type of either operand to the type of the other by a casting conversion (�5.5). The run-time values of the two operands would necessarily be unequal.


-----------
Please don't duplicate posts.
[ August 17, 2002: Message edited by: Jose Botella ]

SCJP2. Please Indent your code using UBB Code
Soum Sark
Ranch Hand

Joined: May 31, 2002
Posts: 50
Thanx for the anwer.. i am having some problems with IE and hence the double thread ..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: == operator