Question: (a) Are the following Interfaces correct? Explain your answer. public interface Test { public static final int K = 1; public abstract void p (
(a) Are the following Interfaces correct? Explain your answer.
public interface Test {
public static final int K = 1;
public abstract void p ( );
} public interface Test1 {
int K = 1;
p ( );
}
(b) The Comparable Interface defined in the java.lang package contains the compareTo method. What is the output of the following examples. Briefly explain how the compareTo method works.
(i) System.out.println(new Integer(3).compareTo(new Integer(5)));
(ii) System.out.println("ABC".compareTo("ABE"));
(iii) java.util.Date date1 = new java.util.Date(2013, 1, 1);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
