I have this function to read text file with BufferedReader. I want to know if I can called another function and pass the readline/continue to read text file. If it can pass, can it loop the same function?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A
BufferedReaderobject is self-contained (thanks to Java’s heavy emphasis on Object Orientation), so you are free to pass it between functions and inside loops, and it will retain it’s state – including the read line.However, if you are trying to call a method to process the line you have just read, then it would be much more efficient to pass the line itself to the method as a
String, instead of passing the entire BufferedReader object.