Any idea please? I am stuck, I look at BufferedReader methods but i didn't found any useful, need to do a method that return a String with the next line to read from a file. When it reach the end of file , it return null instead the String.
It is required that i pass BufferedReader as parameter
The only code I am able to think is "return br.readLine;" somewhere, but obviusly i need to remake that method, and not use it inside. I'm really stucked
import java.io.*; public class leer { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new StringReader("First line\nSecond line")); leeLinea(br); }catch(FileNotFoundException e) { }catch(IOException e){ } } static String leeLinea(BufferedReader br) throws IOException{ String string = ""; //while((string = nextLine()) != null) return string; return null; } }