You are creating a class to compare a specially-formatted string. The default collation
comparisons do not apply. You need to implement the IComparable<string> interface.
Which code segment should you use?
A. public class Person : IComparable<string>{
public int CompareTo(string other){
}}
B. public class Person : IComparable<string>{
public int CompareTo(object other){
}}
C. public class Person : IComparable<string>{
public bool CompareTo(string other){
}}
D. public class Person : IComparable<string>{
public bool CompareTo(object other){
}}
Answer: A
comparisons do not apply. You need to implement the IComparable<string> interface.
Which code segment should you use?
A. public class Person : IComparable<string>{
public int CompareTo(string other){
}}
B. public class Person : IComparable<string>{
public int CompareTo(object other){
}}
C. public class Person : IComparable<string>{
public bool CompareTo(string other){
}}
D. public class Person : IComparable<string>{
public bool CompareTo(object other){
}}
Answer: A
No comments:
Post a Comment