• Support PF! Buy your school textbooks, materials and every day products Here!

Reading a File

  • Thread starter Punkyc7
  • Start date
  • #1
420
0
Can a File object alone be used to read a file?

I am thinking it is no because don't you have to use the scanner class to get the data from the file?

I have tried looking for this online but haven't been able to find the answer.
 

Answers and Replies

  • #2
420
0
I should probably add this is in java
 
  • #3
33,169
4,853
Can a File object alone be used to read a file?

I am thinking it is no because don't you have to use the scanner class to get the data from the file?

I have tried looking for this online but haven't been able to find the answer.
I should probably add this is in java
Yes, that would be good to do.

The File class has no methods for reading (or writing to) a File instance. For the methods on the File class, see http://docs.oracle.com/javase/1.5.0/docs/api/java/io/File.html.
 

Related Threads for: Reading a File

Replies
10
Views
6K
  • Last Post
Replies
14
Views
872
Replies
0
Views
1K
  • Last Post
Replies
5
Views
6K
Replies
2
Views
2K
  • Last Post
Replies
6
Views
2K
Replies
19
Views
2K
Replies
5
Views
38K
Top