Skip to content
Advertisement

Java read file and store text in an array

I know how to read a file with Java using Scanner and File IOException, but the only thing I don’t know is how to store the text in the files as an array.

Here is a snippet of my code:

JavaScript

Here is what my KeyWestTemp.txt file contains:

JavaScript

Advertisement

Answer

Stored as strings:

JavaScript

For floats:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement