Sunday, 11 June 2017

Java Tutorial : Java IO (CharArrayReader) ~ foundjava


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) 
CharArrayReaderDemo.java
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();
            }
        }

    }

}
Output
Peter
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/io/CharArrayReader.html
Click the below link to download the code:

CLICK HERE

No comments:

Post a Comment