Tell the difficulties that i am difficult.
Rameshwar Soni wrote:Hello please refer this thread Wrapper class
Tell the difficulties that i am difficult.
saloni jhanwar wrote: i1 and i2 are in given range then why they are not equal ?
Rameshwar Soni wrote:
saloni jhanwar wrote: i1 and i2 are in given range then why they are not equal ?
Yes i1 and i2 are in the given range but when you are using the new keyword than irrespective of whether the number is in the given range or not Object will be created.
That means i1 and i2 will have different address. Hope this helps![]()
Tell the difficulties that i am difficult.
saloni jhanwar wrote:
Tell the difficulties that i am difficult.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
saloni jhanwar wrote:then what case will be when two wrapper class objects will be == when they have same primitive value ? as written in book.Can you give me an example about it.
Rameshwar Soni wrote:
saloni jhanwar wrote:then what case will be when two wrapper class objects will be == when they have same primitive value ? as written in book.Can you give me an example about it.
As == is to check address therefore 2 Objects will be == when they have same address and not same primitive value (keeping the range -128 and 127 in mind).
Example :
Tell the difficulties that i am difficult.
Rameshwar Soni wrote:
saloni jhanwar wrote:then what case will be when two wrapper class objects will be == when they have same primitive value ? as written in book.Can you give me an example about it.
As == is to check address therefore 2 Objects will be == when they have same address and not same primitive value (keeping the range -128 and 127 in mind).
Example :
Tell the difficulties that i am difficult.
Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
|