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 doubt? 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 doubt?" Watch "== operator doubt?" New topic
Author

== operator doubt?

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

How does and what happend when we try 5 == 5?? with a java 1.4 version?? I tried with 1.5 and it gave me true as the o/p.

Anyone here to explain this?


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Ignacio Cavero
Greenhorn

Joined: Dec 10, 2006
Posts: 4
It's going to happen the same thing in java 1.4 or 1.5, java is designed to be backwards compatible. In both cases the == compares if the primitives have the same value, or if the references both point to the same instances of the object (to know if two different instances both represent the same object you must override and use the .equals method defined in Object)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: == operator doubt?
 
Similar Threads
How many strings are created?
Rules or exceptions?
How many languages do you speak ...
Java EE version used in SCEA 5 310-052
when 400 mark will reach?