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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started