Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4542584
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:24:42+00:00 2026-05-21T15:24:42+00:00

I have some classes like Client, Employee, Property I am maintaining the list of

  • 0

I have some classes like Client, Employee, Property
I am maintaining the list of all the objects as array lists in a class names NIC.
So Java code for class NIC is like:

    class NIC
{
  static ArrayList<Employee> employeeList = new ArrayList<Employee>();
  static ArrayList<Property> propertyList = new ArrayList<Property>();
  static ArrayList<Client> clientList = new ArrayList<Client>();

 //rest of the code
  public static void backItUp()
  {
    //this method reads all the objects data from array lists and stores it in a file
  }
}

I am stuck on the method backItUp() which is supposed to read all the objects data from array list and store it in a file.

I don’t know if there is any method which can access all the data fields of current class or at least returns a reference of each data field.

Please help. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:24:42+00:00Added an answer on May 21, 2026 at 3:24 pm

    Your best option is to remove the static modifiers from all your fields and methods, and make NIC a proper object that can be instantiated. When you adhere to OOP (Object Oriented Principles), you’ll find everything becomes easier. After that, all you need to do is make NIC implement Serializable. The default serialization routine will automatically save everything in your class that is not marked as transient. ArrayLists and all other JDK collections are already serializable, so no further work is required. Just read the guide that KDM posted.

    However, if you decide to add more fields or methods later, you will still end up with compatibility problems since old persisted objects will no longer match the signature of the new, updated class. This is a consideration all programmers must make. Using serialVersionUID can help a little, for instance, in cases where you’re just adding new methods but no new fields, but proper testing is needed to ensure backwards compatibility.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have some classes like this: abstract class View(val writer: XMLStreamWriter) {
I have some java classes like, Class User { String email; String name; String
I have some classes(call it Class A) which I would like to unit test
I am designing some immutable classes but I have to have some variables like
I have authored some custom classes that I would like to create using XAML:
I have some classes that represent immutable objects (Quantity, Price, Probability). Is there some
I have the following classes: Client ClientCacheMedia ( contains Client, Media and some other
I have a DLL made in C#, this DLL contains some clases like Creator.
I have some classes which extends a superclass, and in the JSP I want
I have some classes that, for one reason or another, cannot be or need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.