Question: You can define the compareTo method in a class without implementing the Comparable interface. What are the benefits of implementing the Comparable interface? class B
You can define the compareTo method in a class without implementing the Comparable interface. What are the benefits of implementing the Comparable interface?
class B implements A
void m
System.out.printlnm;
Suppose A is an interface. Can you create an instance using new A
Suppose A is an interface. Can you declare a reference variable x with type A like this?
A x;
Show the error in the following code:
interface A
void m;
class B implements A
void m
System.out.printlnm;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
