Dear Friends,

This is my homework, I have a text file containing the following content:

0 12
1 15
2 6
3 4
4 3
5 6
6 12
7 8
8 8
9 9
10 13

I want to read these integers from data.txt file and save the two columns into two different arrays in Java.

I am a beginner in Java, and thank you for your help.

Recommended Answers

All 2 Replies

We don't actually do people's homework for them here.
Have a try, make a start, when you get stuck come back with a specific question and someone will help.

Member Avatar for hfx642

Open the file and read the file line by line (Look up BufferedReader).
Parse the line to get the integers (Look up Tokenization).
Close the file.
It's actually quite simple.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.