1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Reading a File

  1. Dec 6, 2011 #1
    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.
     
  2. jcsd
  3. Dec 6, 2011 #2
    I should probably add this is in java
     
  4. Dec 7, 2011 #3

    Mark44

    Staff: Mentor

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook