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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started