Q:

searching by last name in an array

I made a contact list with three classes, the ContactList class holds an array which stores Last Name, First Name, Street, City, State, ZIP, Country, Email, Phone No., and Notes.
I want to implement a search function by last name into the class of ContactList, where it shows all the information of the contact who has the last name the user searched for, but i cant seem to get anything to work. :(
import java.util.*;

public class ContactList {

    //declaration of an array and its attributes
    private final int SIZE = 10;
    private Person [ ] list;
    private int nextEmptyElementInArray = 0;

    // Constructor for ContactList object
    public ContactList ()   {
        list = new Person [SIZE];
    }

    // Method that adds a new contact into the array
    public void addNewContact() {
        list[nextEmptyElementInArray] = new Person();
        list[nextEmptyElementInArray].read();
        nextEmptyElementInArray++;
    }

    // Method retrieves contacts by last name

    int searchByLastName(Person [] list) {
        Scanner console;
        console = new Scanner(System.in);
        String searchByLastName = console.next();
        for (int i= 0; i< list.length; i++) {
            if (list[nextEmptyElementInArray].lastName.equals(searchByLastName)) 
                return i;
            }
            return -1;
        }
    }

A:

Your list subscript appears to be wrong: for each iteration of the loop you're doing this:
if (list[nextEmptyElementInArray].lastName.equals(searchByLastName))

If I understand the question correctly, you should be doing this:
if (list[i].lastName.equals(searchByLastName))

Also, be careful about naming your variable the same as the function. At best it'll cause confusion.
[Edit] Just noticed you're pre-allocating the list, then managing actual content length using nextEmptyElementInArray. Your for loop should probably go something like this:
for (int i= 0; i< nextEmptyElementInArray; i++)

