Click here to watch in Youtube :
Click the below Image to Enlarge
Java Tutorial : Java IO (StringReader) |
Java Tutorial : Java IO (StringReader) |
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();
}
}
}
}
OutputHello
Refer:https://docs.oracle.com/javase/8/docs/api/index.html?java/io/StringReader.html
No comments:
Post a Comment