Sunday, 11 June 2017

Java Tutorial : Java IO (StringReader) ~ foundjava


Click here to watch in Youtube :

Click the below Image to Enlarge
Java Tutorial : Java IO (StringReader) 
Java Tutorial : Java IO (StringReader) 

StringReaderDemo.java
import java.io.StringReader;

public class StringReaderDemo
{

    public static void main(String[] args) throws Exception
    {
        StringReader stringReader = null;
        try
        {
            String str = "Hello";
            stringReader = new StringReader(str);

            int data;
            while ((data = stringReader.read()) != -1)
            {
                System.out.print((char) data);
            }

        }
        finally
        {
            if (stringReader != null)
            {
                stringReader.close();
            }
        }
    }
}
Output
Hello
Refer:
https://docs.oracle.com/javase/8/docs/api/index.html?java/io/StringReader.html
Click the below link to download the code:

CLICK HERE

No comments:

Post a Comment