How do I read multiple lines (in Java) from an input file (say, helloworld.in)?
The input file does not have a fixed number of lines, it can have anywhere from 3 to 99999 lines.
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.
Use a java.util.Scanner:
With a scanner, you can also read specific types, eg scanner.nextInt() etc