Create a new record

Posted on 2004-03-31
Last Modified: 2010-03-31
i'm new to java, so can anyone please help me?
i'm making an address book program and it has
first name
last name
street adress
post code
phone number

can some one please tell me how to create a record of list?

thanks very much

Question by:atjendrasa
  • 3
LVL 86

Accepted Solution

CEHJ earned 50 total points
ID: 10723278
You mean a list of record?

We can't do classwork here btw - only help you with work that you've produced

Expert Comment

ID: 10723340
something to get you started....but you have to do the rest your self

public class  myRec
    String firstname, lastName,streetAddress,postCode;
    int phoneNum;
  //or String phoneNum; depending on the format

   String getfirstName(){
    return firstName;
   void setfirstName(String fn){
    // and other get and set methods

myRec newrec= new myRec();

ArrayList myArrayofRec= new ArrayList();


LVL 86

Expert Comment

ID: 10723447
That should follow conventions thus:

public class Entry {
      private String firstName;
      private String lastName;
      Entry(String firstName, String lastName) {
            // other fields needed too
            this.firstName = firstName;
            this.lastName = lastName;

      public void setFirstName(String firstName) {
        this.firstName = firstName;

      public String getFirstName() {
        return firstName;

      public void setLastName(String lastName) {
        this.lastName = lastName;

      public String getLastName() {
        return lastName;

LVL 86

Expert Comment

ID: 10723454

>>Entry(String firstName, String lastName) {

should be

public Entry(String firstName, String lastName) {

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 49
hibernate example issues from command prompt 10 64
jsp login check 12 52
Setup GlassFish 4 35
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question