/** * @author lautturi.com * Java example: Java reader from string */ import java.util.*; import java.io.*; public class Lautturi { public static void main(String[] args) throws NumberFormatException, IOException { String str = "welcome to lauttur! \njava world!"; BufferedReader br = new BufferedReader(new StringReader(str)); String line = br.readLine(); System.out.println(line); } }
output:
welcome to lauttur!