The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Re: Comparing two classes

Posted by Brian Sanders on November 27, 2001 at 8:45 PM

Could you give more specific information as to what you want? If you're just trying to make a class that compares two values, then the code is very simple:

class Compare
private FirstClass c1;
private SecondClass c2;

Compare(FirstClass first, SecondClass second)
c1 = first;
c2 = second;

public boolean haveSameValue()
return c1.getSomePrimitiveValue() == c2.getSomeOtherPrimitiveValue();

I'm really not sure what you're asking.

  • Comparisons Chet Underwood, Esq. November 28, 2001 at 2:26 PM (0)

Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us