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.
Message:
Comparisons
Posted by Chet Underwood, Esq. on November 28, 2001 at 2:26 PM
Avin, if your teacher has posted the assignment on the web, you could give the url here, so we know exactly what the requirements are. > 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.
Replies:
|