This discussion is archived
7 Replies Latest reply: Sep 19, 2012 6:58 AM by 939520 RSS

store details in a java program

user10873676 Newbie
Currently Being Moderated
Hi,

This is a sample scenario
I am taking interviews daily, I need to store candidate name, gender, dob, phone number in a java program
I do not want to store it at any other secondary storage like db, flat file etc.. As soon as i switch off the system the data should be lost

What is the best method that i can store it in a java program...
I came across this question where someone asked me and i replied that i will store it in arrays, but here for array i have to define size.. so may be on a day there are only one to two entries so un-necessarily i do not want to waste the memory is there any other better way where i can store and performance also doesn't get impacted

Thanks,
  • 1. Re: store details in a java program
    RMishra Journeyer
    Currently Being Moderated
    Hi I am not sure about this is best, is it? but you can create a class Condidate and when you are entering maintaining condidate details then you can do like this:
    Map view=new HashMap();

    Condidate c=new Condidate();
    c.setCondidateId(anyInt);
    c.setXXX(...)
    ....................
    view.put(c.getCodidateId(),c);

    -RMishra
  • 2. Re: store details in a java program
    maheshguruswamy Journeyer
    Currently Being Moderated
    user10873676 wrote:
    Hi,

    This is a sample scenario
    I am taking interviews daily, I need to store candidate name, gender, dob, phone number in a java program
    I do not want to store it at any other secondary storage like db, flat file etc.. As soon as i switch off the system the data should be lost

    What is the best method that i can store it in a java program...
    I came across this question where someone asked me and i replied that i will store it in arrays, but here for array i have to define size.. so may be on a day there are only one to two entries so un-necessarily i do not want to waste the memory is there any other better way where i can store and performance also doesn't get impacted

    Thanks,
    Search for in memory databases for java. HSQLDB is a good one to start with.
  • 3. Re: store details in a java program
    939520 Explorer
    Currently Being Moderated
    How about:

    List<Condidate> = new ArrayList<Condidate>();

    The list will dynamically grow as you add people.
  • 4. Re: store details in a java program
    rp0428 Guru
    Currently Being Moderated
    >
    I am taking interviews daily, I need to store candidate name, gender, dob, phone number in a java program
    I do not want to store it at any other secondary storage like db, flat file etc.. As soon as i switch off the system the data should be lost
    >
    That functionality has been available for over 50 years before Java was invented.

    It's call a 'magic slate'. You can get one here for only $2.99 :D
    http://www.oldtimecandy.com/magic-drawing-slate.htm
  • 5. Re: store details in a java program
    Kayaman Guru
    Currently Being Moderated
    user10873676 wrote:
    I came across this question where someone asked me
    Did someone ask you that in an interview?

    I heard of a recent study that outsourced code has 40 times the amount of bugs compared to locally written. I don't find that hard to believe at all.
  • 6. Re: store details in a java program
    EJP Guru
    Currently Being Moderated
    I'm surprised it's that low. It's not at all hard for bug rates to escalate. In my experience communication bandwidth is an inverse function of the square of the distance, just like gravitation.
  • 7. Re: store details in a java program
    939520 Explorer
    Currently Being Moderated
    I think the bigger issue would be poor requirement specifications and not so much buggy code based on those requirements. Communications is usually poor no matter where its coded.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points