Click here to watch in Youtube :
Click the below Image to Enlarge
Java Tutorial : Java IO (CharArrayReader) |
Java Tutorial : Java IO (CharArrayReader) |
Java Tutorial : Java IO (CharArrayReader) |
import java.io.CharArrayReader;
import java.io.IOException;
public class CharArrayReaderDemo
{
public static void main(String[] args) throws IOException
{
CharArrayReader charArrayReader = null;
try
{
char[] charArray = "Peter".toCharArray();
charArrayReader = new CharArrayReader(charArray);
int i;
while ((i = charArrayReader.read()) != -1)
{
System.out.print((char) i);
}
}
finally
{
if (charArrayReader != null)
{
charArrayReader.close();
}
}
}
}
OutputPeter
Refer:https://docs.oracle.com/javase/8/docs/api/index.html?java/io/CharArrayReader.html
No comments:
Post a Comment