vendredi 13 février 2015

Static max method in the GeometricObject class for finding the larger of two GeometricObject objects


I am using Static max method in the Geometric Object class for finding the larger of two Geometric Object objects. I did a method but I am wondering if their is any better method I can be able use. I want the max method so I can be able to find the larger of two Geometric Objects. Thanks for your time.



public static Comparable max(Comparable ob1, Comparable ob2)
{
if (ob1.compareTo(ob2) > 0)
return ob1;
else
return ob2;
}




Aucun commentaire:

Enregistrer un commentaire