Learn Programming in Java – Lesson 17: File Input/Output

Java

Video is ready, Click Here to View ×


In this lesson we cover how to read data from and write data to files. We’ll discuss the two common file formats, text and binary and how to perform basic file operations on them. We will learn object serialization and de-serialization techniques to make our objects persistent and read and write collections of objects to/from disk.

29 thoughts on “Learn Programming in Java – Lesson 17: File Input/Output

  1. If I use FileInputStream(file,true) to not owerwrite the old lines, I to read. It is print error type:AC :(((((((((((
    Just in case if I read every lines objects….. Do u have an ideal?

  2. Thank for the video, It has been very helpful for me. But why do we have to use while(true)? I thought it has nothing to do with boolean. Can somebody explain? Sorry silly question coz I'm still beginner. 😀

  3. Hi Michael. You explained so clearly. Thanks a lot. But please help me with my problem. Whenever I run my code, this is what is see: java.io.StreamCorruptedExecution: invalid type code: AC. And it points to line Student s = (Student) ois.readObject(); which is inside while(true) loop. Please help me. Thanks.

  4. This video helped me find an efficient way to store a 3 dimensional boolean array in a file and load it in the future instead of repeatedly computing it. In some cases it's a little benefit, but in mine it helps a lot as I've been working on a 2D game with several levels, which are based on a image, from which a map is generated.

  5. This was by far the most helpful tutorial on I/O streams I have ever seen. I have read books and watched courses from big time universities, like John Hopkins, but this was the only one that truly helped me. Thank you so much.

  6. I want to read user input through textfield, radio button, etc in jframe and write those data to a file with unique autoincrementing name of that file. I have to be able to set the path of that file as per my need. Can someone help me?

Leave a Reply

Your email address will not be published. Required fields are marked *