File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
Similar Threads
can any one explain this
Picking variables with a given propability
Iterations - finding the same value for 2 variables
Interview Question
convert Postiive number to negative..