Results 1 to 6 of 6
- 04-27-2009, 09:25 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
- 04-27-2009, 10:45 AM #2
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
do your "equal" means assign to other memory location?
- 04-27-2009, 10:47 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 20
- Rep Power
- 0
xpngamer,
I did not get the question properly.
Can you clarify whether you are asking about the comparison of two objects or you want to assign value to a object?
- 04-27-2009, 10:57 AM #4
Iam not getting ur question.But,if u want to check the equality this is the below method.
Sample code
class Sample
{
public static void main(String[] args)
{
//Test is a class and i have created 2 objects for Test and comparing.
Test obj1 = new Test();
Test obj2 = new Test();
Test[] array1 = new Test[]{obj1};
Test[] array2 = new Test[]{obj2};
if(array1[0].equals(array2[0]))
System.out.println("hi");
}
}
- 04-27-2009, 11:33 AM #5
Senior Member
- Join Date
- Aug 2008
- Posts
- 384
- Rep Power
- 5
Object.clone()?
I die a little on the inside...
Every time I get shot.
- 04-27-2009, 11:38 AM #6
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
for object using clone, remember to implements Cloneable interface
Similar Threads
-
Operator < cannot be applied to java.lang.Object, Object
By Albert in forum Advanced JavaReplies: 2Last Post: 11-26-2010, 02:12 AM -
how to pass an arraylist from an object back to the parent object that it was created
By george_a in forum New To JavaReplies: 1Last Post: 03-04-2009, 06:14 PM -
Parsing a superclass object to subclass object dynamicly
By Andrefs in forum Advanced JavaReplies: 1Last Post: 07-22-2008, 04:27 PM -
[SOLVED] If a object equals another object, do they contain the same data?
By bobleny in forum New To JavaReplies: 1Last Post: 04-17-2008, 10:10 PM -
Creating object of Type Object class
By venkatv in forum New To JavaReplies: 3Last Post: 07-17-2007, 03:33 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks