aspose file tools*
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
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 ..
 
Consider Paul's rocket mass heater.
 
subject: == operator