Question: Review Java OO principles . Show equals in use by writing one if () that checks whether s String s is equal to a String
-
Review Java OO principles.
- Show equals in use by writing one if () that checks whether s String s is equal to a String t, character by character. Explain what this comparison is doing if s = abc and t = abx. Compare this to what happens in if (s == t).
- Find the hashCode and toString values for String s = abc. Also for the Integer of value 6.
- Write a Java interface source file UnionFind.java to express the API on page 219, the union-find interface. Also rewrite just the first line of UF.java to assert that class UF implements this interface. Here is the API that I need an interface for :
Here is the API in which I need a java interface for
public class UF
UF(int N) initialize N sites with integer names (0 to N-1)
void union(int p, int q) add connection between p and q
int find(int p) component identifier for p (0 to N-1)
boolean connected(int p, int q) return true if p and q are in the same component
int count() number of components
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
