How to read txt file in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to read txt file in java

I am compiling my code in solo.learn app in my Android phone It's throwing file not found errors

23rd Sep 2020, 6:04 AM
Sage Tode
Sage Tode - avatar
2 Answers
0
I don't think SoloLearn supports file reading. But you can start by sharing your code.
23rd Sep 2020, 6:24 AM
Aleksandrs
Aleksandrs - avatar
0
Can't read a file in sololearn, but you can get around it by putting a string of the data in the scanner to simulate reading a file. Here's an easy example: https://code.sololearn.com/c5Td5Lrco5s3/?ref=app And here's an actual application of this; this is a homework assignment where I actually had to read in a .dat file. Lines 247 to 287 is the actual code commented out and the simulation code. (ported it to here to ask a question) https://code.sololearn.com/cb813Qlfu8XV/?ref=app If the file is too big you'll have to separate the strings into different varables since they have a character limit and change strings in the scanner object through loops and conditionals.
23rd Sep 2020, 6:52 AM
Odyel
Odyel - avatar