|
-
Object type compare
I need to be able to make a method which performs a generic Object type comparison:
boolean compare(Object obj1, Object obj2)
{
if(obj1 type == obj2 type)
return true;
else
return false;
}
Example:
Image var1, var2;
int var3, var4;
test1 = compare(var1, var2);
test2 = compare(var3,var4);
test3 = compare(var1,var4);
test4 = compare(var2, var3);
and the result should be: test1=true, test2=true, test3=false, test4=false.
How can I do?
I think I can't use "istanceof", because in this case I must know the type of one of the two object in the comparison. In this case the comparison would be no more generic.
RB
Thanks
R.B.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks