Question: Interfaces What is a Java interface? See S&W page 100 for an example. Note that an interface can have constants as well as methods, so

Interfaces

  1. What is a Java interface? See S&W page 100 for an example. Note that an interface can have constants as well as methods, so the statement there that an "interface is nothing more than a list of instance methods" is not completely true.
  2. Write a Java interface source file UnionFind.java to (as far as possible) express the API on page 219, the union-find API. Also rewrite just the first line of UF.java to assert that class UF implements this interface.
  3. What methods/constructors of UF.java, page 221, are not in the interface?
  4. Does WeightedQuickUF, page 228, qualify for implementing the interface? Explain why or why not.

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!