Question: This is java prblem you have a method public int comparation(Object n1, Object n2) { return ((int)n2-(int)n1); it will return positive number if n1 is
This is java prblem
you have a method
public int comparation(Object n1, Object n2) { return ((int)n2-(int)n1);
it will return positive number if n1 is less than n2 thats mean n1 should follow by n2
return negative number if n1 is greater than n2 that means n1 should come after n2 and if it returns 0 that means both are equal
is there anyway to write return statement rather than using return ((int)n2-(int)n1);
i am not sure what is going on using this return statement so if you could give me alternate return statement that easier to understand would be very appriciated.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
