P
P
pshevnin2021-02-19 18:41:46
Java
pshevnin, 2021-02-19 18:41:46

How to read one txt file in java twice?

It is necessary to read an array of numbers from a txt file, while not using any "smart" sheets in Java, that is, only int[ ] is available. Accordingly, to create an array, you must first find out the number of lines in the file. The problem is that after going through that txt for the first time, I can't get back to the first line of the file to start reading it. (I use FileReader)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Roo, 2021-02-19
@pshevnin

Read as string and then split (.split(...))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question