1.

Choose the constructor type used to build strings from character array.(a) public String(value)(b) public String(char[ ] value, int startIndex, int length)(c) public String(char[ ])(d) all of the mentionedThis question was posed to me at a job interview.My question is from Introduction of String Formatting topic in section Miscellaneous topics of C#

Answer»

The CORRECT option is (b) PUBLIC String(char[ ] VALUE, int startIndex, int length)

To explain: public String(char[ ] value) – This form of constructor CONSTRUCTS a string that contains characters in value

public String(char[ ] value, int startIndex, int length) -The second form uses length characters from value, beginning at the index specified by startIndex.



Discussion

No Comment Found

Related InterviewSolutions