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

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!