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
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
== usually compares two objects as pointing to the same reference.
even if you had ...
String a = new String("A");
String b = new String("A");
you should get false when you say...
System.out.println(a == b);


scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Please don't post duplciate threads.
Reply to the Original thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: == operator
 
Similar Threads
Iterations - finding the same value for 2 variables
Picking variables with a given propability
Interview Question
can any one explain this
convert Postiive number to negative..