Ok so this may be a dumb question, but how do I pass a text file into my java program and likewise have a method which reads over it? I know I need to use a scanner. But I have unsuccessfully gotten the program to even recognize the text file. Any ideas?
Asked
Active
Viewed 29 times
0
-
You _could_ pass an entire text file to a Java program, but a more typical usage would be to pass the _filename_ instead. If you show us some code, maybe we can give you better pointers. – Tim Biegeleisen Dec 14 '15 at 05:06
1 Answers
0
Here's a link to one way to do it, try googling it also if this doesn't help. Java: How to read a text file
This is a pretty common thing in java and should have many examples online.
You could also use a reader of some sort such as a bufferedReader https://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html

Community
- 1
- 1

James Russo
- 578
- 3
- 18