Results 1 to 2 of 2
  1. #1
    KevinNguyen is offline Member
    Join Date
    Oct 2012
    Posts
    18
    Rep Power
    0

    Default Error reading file

    OK, so I get another error right here. I have class B and class C extend abstract class A. I create a ArrayList<A> lst = new ArrayList<A>() then add both B and C objects type into that ArrayList then write that ArrayList to file data.dat. When I read it, only attributes from B and C is read to the ArrayList and attributes that B and C inherit from A is gonna be "null" and 0.
    I would ask if this problem is caused by that I use generic type ArrayList<A> so only the attributes of B and C are read into ArrayList or by other reason. Finnaly, how to solve it? Thanks :)

  2. #2
    KevinNguyen is offline Member
    Join Date
    Oct 2012
    Posts
    18
    Rep Power
    0

    Default Re: Error reading file

    OK, seem to be solved by adding serialVersion for class A :)

Similar Threads

  1. Error in reading from a file containing integers
    By stud91 in forum Advanced Java
    Replies: 1
    Last Post: 07-07-2012, 05:24 PM
  2. Error reading file
    By sehudson in forum New To Java
    Replies: 3
    Last Post: 03-01-2011, 04:44 AM
  3. Reading A CSV file error.
    By jetnor in forum New To Java
    Replies: 3
    Last Post: 02-05-2011, 03:51 AM
  4. error in reading objects from file
    By sakshi in forum New To Java
    Replies: 3
    Last Post: 07-27-2009, 08:17 AM
  5. reading from a zip file, error
    By Mr tuition in forum AWT / Swing
    Replies: 1
    Last Post: 01-16-2008, 12:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •