PdfPrep.com

Which of the following code statement will John include in his application?

John works as a Software Developer for Blue Well Inc. He wants to create a class named

Class1 and implements the generic IComparable interface.

He writes the following code:

public class Class1 : System.IComparable<Class1>

{

}

However, John needs to compare one object of Class1 with another object.

Which of the following code statement will John include in his application?
A . public int CompareTo(object obj){}
B . public object CompareTo(int obj){}
C . public object CompareTo(Class1 obj){}
D . public int CompareTo(Class1 obj){}

Answer: D

Exit mobile version