Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

error in insert function

  • 05-03-2008 03:15PM
    #1
    Closed Accounts Posts: 20


    public static PhoneBookEntry [] insert(PhoneBookEntry p, PhoneBookEntry [] aContacts) {
    int len = aContacts.length;
    PhoneBookEntry [] aContacts2 = new PhoneBookEntry[len+1];

    for (int x=0; x<len; x++) {
    aContacts2[x] = aContacts[x];
    }

    aContacts2[len+1].name = p.name;
    aContacts2[len+1].number = p.number;

    aContacts = aContacts2;
    System.out.println("Name" + aContacts[0].name + " Number " + aContacts[0].number);


    return aContacts2;
    }


Comments

  • Closed Accounts Posts: 3,357 ✭✭✭Beano


    you're going to have to give a little more info.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    How are people supposed to help you when you don't even tell us what's going wrong?

    Try again. State what your trying to achieve, what the problem is and where you think it is occuring. Include any error messages.

    ffs.


This discussion has been closed.
Advertisement