Question: JDK Sorting. Give the calls to Arrays.sort() or Collections.sort() needed to sort. Just the syntax of the calls, plus additional material as specified. String[] names

  1. JDK Sorting. Give the calls to Arrays.sort() or Collections.sort() needed to sort. Just the syntax of the calls, plus additional material as specified.
    1. String[] names = {"Joe", "Annie", "Bruce", "Tien"};
    2. int[] numbers = {3,2,10};
    3. Using Point2D from S&W: Point2D[] points = {new Point2D(1.0, 2.0),new Point2D(3.0, -2.0), new Point2D(2.0, 0.0)}; using their natural order (the compareTo order). What is that "natural" order? Interpret compareTo to see and describe it in your submission.
    4. points again, but using their r values (radius from Origin). Create an easy Java 8+ Comparator to do the job. These were covered in the class of Feb.25. In fact, Point2D has code for an old-fashioned Comparator based on r. Find it and use it as well by calling a method of Point2D that delivers that Comparator and using it in your call to sort.
    5. Using BankAccout.java and code to set up a List as follows. List accounts = new LinkedList(); accounts.add(new BankAccount("Joe", 100, 100)); accounts.add(new BankAccount("Sue", 101, 200));; sort by balance, using a Comparator and list sort.
    6. Become an expert on interfaces. From Weiss problem 4.17

      Answer each part TRUE or FALSE:

      a. An interface can declare instance variables.

      b. Any method in an interface must be public.

      c. An interface can have no methods at all.

      d. An interface can extend another interface.

      e. An interface can declare constructors.

      f. A class may extend more than one class.

      g. A class may implement more than one interface.

      h. A class may extend one class and implement one interface.

      i. An interface may implement some of its methods.Ignore the new Java 8 feature "default methods for interfaces" here.

      j. All methods in an interface must have a void return type.

      k. Object is an interface.

      l. Comparable is an interface.

    7. Please help me as soon as possible

    8. Thank you so much

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!