PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating a class to compare a specially-formatted string.
The default collation comparisons do not apply.
You need to implement the IComparable interface.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
public class Person : IComparable{
public int CompareTo(string other){
}
}

B.
public class Person : IComparable{
public int CompareTo(object other){
}
}

C.
public class Person : IComparable{
public bool CompareTo(string other){
}
}

D.
public class Person : IComparable{
public bool CompareTo(object other){
}
}

One Comment on “Which code segment should you use?


Leave a Reply