语法public class stringreader extends reader
示例import java.io.stringreader;import java.io.ioexception;public class stringreadertest { public static void main(string[] args) { string str = "welcome to tutorials point"; stringreader strreader = new stringreader(str); try { int i; while((i=strreader.read()) != -1) { system.out.print((char)i); } } catch(ioexception ioe) { system.out.println(ioe); } finally { if(strreader != null) { try { strreader.close(); } catch(exception e) { system.out.println(e); } } } }}
输出welcome to tutorials point
以上就是stringreader类在java中的重要性是什么?的详细内容。
