GIAC
GSSP-.NET · Question #39
(Topic 1) 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…
The correct answer is D. public int CompareTo(Class1 obj){}. See the full explanation below for the reasoning.
Question
- (Topic 1)
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?
Options
- Apublic int CompareTo(object obj){}
- Bpublic object CompareTo(int obj){}
- Cpublic object CompareTo(Class1 obj){}
- Dpublic int CompareTo(Class1 obj){}
How the community answered
(28 responses)- A14% (4)
- B7% (2)
- C4% (1)
- D75% (21)
Community Discussion
No community discussion yet for this question.