[Logo]
Forums Register Login
how sort math.sqrt
Hello,

I have code that count the square.
But I want to sort the width and height.

I have two questions:
When I use return I get the error: unnecessary return statement. How is this possible?

And how can I use the variable 'end' for to sort the width and height?

can someone help me?

thanks in advance

i have not seen any constructor for the Class object in the API then how can you do like this:

their is built in class for Class type object in the API in lang package if you have named any
class "Class" then rename it.

also the curly braces after the abstract method doesnot carry any identifier thats why are you
an error.
welcome to javaranch wesley.

what i think is you have an intension of providing a body to abstract method,but it is not the definition of abstract method.so
in order to do so simply replace abstract with any other type or Override it in the extending class.and also please mention me what do you need to sort or more specifically about your problem.
Welcome again

I am afraid I don't understand the design of the app. You have got an abstract class and made it implement Comparable. That doesn't look quite right. Read this, which tells you that Comparable represents a total ordering and a natural order. That means that for every pair of instances of that class, you can hold your hand on your heart and say one of the following things:-
  • 1: Object 1 is greater than object 2.
  • 2: Object 1 is less than object 2.
  • 3: Object 1 is the same as object 3.
  • I am not convinced you can do that with shapes. If you have a circle diameter 10, is it larger or smaller than a square with a diagonal 10? Does a circle have height and width? Does a circle have a diagonal?

    By the way, there is a method in the Math class which calculates diagonals for you without your having to do all the arithmetic yourself.
    There’s no place like 127.0.0.1. But I'll always remember this tiny ad:
    Rocket Oven Kickstarter - from the trailboss
    https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


    This thread has been viewed 292 times.

    All times above are in ranch (not your local) time.
    The current ranch time is
    Jul 21, 2018 13:13:14.