Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Core Java - Interview Questions and Answers for 'Char array' - 2 question(s) found - Order By Rating | ||||
| ||||
Ans. String has an argument constructor that take char array as argument and creates a string. There is no constructor available with String that takes in a character and creates a String. We can use StringBuilder which has a char argument constructor. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  character  char  char array  String  char to String  char array to String | ||||
Related Questions | ||||
Why Char array is preferred over String for storing password? | ||||
How can we convert String into Char array and vice versa ? | ||||
| ||||
Ans. There is a method toCharArray() within String class that can be used to convert string to char array. string.toCharArray(); String class has an argument constructor that takes a char array and create a string new String(charArray); | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  string  char array | ||||
Related Questions | ||||
Why Char array is preferred over String for storing password? | ||||
How can we convert a character or a character array into a String ? | ||||