Java: Create a new String object with the contents of a character array
11. String from Character Array
Write a Java program to create a String object with a character array.
Sample Solution:
Java Code:
Sample Output:
The book contains 234 pages.
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Java program to construct a string from a character array and then reverse it without using library methods.
- Write a Java program to build a string from a character array while removing any duplicate characters.
- Write a Java program to convert a character array to a string and then interleave it with another string.
- Write a Java program to create a string from a character array and then display the indices of each vowel.
Go to:
PREV : Compare with StringBuffer.
NEXT : Ends With Substring.
Java Code Editor:
Improve this sample solution and post your code through Disqus
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.