![]() |
VOOZH | about |
In Java, we can convert a string to a char stream with a simple built-in method .toCharArray(). Here, we want to convert the string to a char stream without using built-in library functions. So, we will create an empty char array iterate it with string characters, and store the individual characters from the string to the char array one after the other.
In this article, we will learn how to convert String to char stream in Java without using library functions.
Input: Hello World
Output: H e l l o W o r l dInput: She is Intelligent
Output: S h e i s I n t e l l i g e n t
Below is the implementation to convert string to char stream using charAt() method in Java.
Stirng Data : Hello World Converted Character Stream : H e l l o W o r l d