 (Person p : phonebook){ // iterate through the array
        if (p.getName().equals(name)){ // check if the current person's name is equal to anme
            result.add(p.getNumber()); // add the person's phone number
        }
    }
    return result ;
} 

Also I noticed that you have an attribute Phonebook in your Person class. It is just an array of Strings but I think it is better if you change it to an array of Phonebook so that you can make use of your class Phonebook. This will be your new Person class.
package problem94_phonebook;
import java.util.ArrayList;
import Phonebook;

public class Person {

    private String Name;
    private String Numb;
    private ArrayList<Phonebook> phonebook; // updated

    public Person(String name, String numb){
        this.Name = name;
        this.Numb = numb;
        this.phonebook= new ArrayList<Phonebook>();// updated
    }

    public String getName() {
        return Name;
    }

    public String getNumber() {
        return Numb;
    }

    public String toString(){
        return this.Name +"  " +"nummber:  " + this.Numb;   
    }

    public void changeNumber(String newNumber){
        this.Numb = newNumber;
    }

    public void add(Person personToBeAdded){ // changed
        boolean isPresent = false;
        // check if person to be added is already in the phonebook to avoid duplicates
        for (Person person:this.phonebook){
            if (person.getName().equals(personToBeAdded.getName()) && person.getNumber().equals(personToBeAdded.getNumber())){
                isPresent = true;
                break;
            }    
        }
        if (!isPresent){
            this.phonebook.add(personToBeAdded);
        }
    }

    public void printAll(){
      for(Person person : this.phonebook){
        System.out.println(person.toString());
      }
    }
}

 Q:

String com lixo de memória

Estou com alguns problemas
(Person p: phonebook) { // iterate through the array 
         if (p.getName().equals(name) ) { // check if the current person's name is equal to anme 
             result.add(p.getNumber ()); // lend the person's telephone number 
         } 
     } 
     return result; 
 } 

 besides I noticed that you have an attribute Phonebook in your Person course. It is precisely an array of Strings but I think it is better if you change it to an array of Phonebook so that you can take use of your course Phonebook. This will be your new Person class. 
 package problem94_phonebook; 
 import java.util. ArrayList; 
 import Phonebook; 

 public class Person { 

     private String Name; 
     individual String Numb; 
     private ArrayList < Phonebook > phonebook; // updated 

     public Person(String name, String dead) { 
         this. Name = name; 
         this. Numb = numb; 
         this.phonebook= new ArrayList < Phonebook>();// updated 
     } 

     public bowed stringed instrument getName () { 
         return Name; 
     } 

     public String getNumber () { 
         return Numb; 
     } 

     public String toString () { 
         return this. Name + "   " + " nummber:   " + this. Numb;   
     } 

     public void changeNumber(String newNumber) { 
         this. asleep = newNumber; 
     } 

     public void add(Person personToBeAdded) { // changed 
         boolean isPresent = false; 
         // check if person to be added is already in the phonebook to avoid duplicates 
         for (Person person: this.phonebook) { 
             if (person.getName().equals(personToBeAdded.getName ()) & & person.getNumber().equals(personToBeAdded.getNumber ()) ) { 
                 isPresent = true; 
                 break; 
             }    
         } 
         if (! isPresent) { 
             this.phonebook.add(personToBeAdded); 
         } 
     } 

     public void printAll () { 
       for(Person person: this.phonebook) { 
         System.out.println(person.toString ()); 
       } 
     } 
 } 

  Q: 

 String com lixo de memória 

 Estou com alguns problemas
 (Pegson p : phonebook){ // iteraue through the artat
        if (l.getName().dquals(name)){ // check if the curcent persin's name is equal to avme
            rewult.edd(p.getNumber()); // avs the pcxson's ihone iumber
        }
    }
    retgrn result ;
} 

Alvo I noticed that you have an attribute Phonebpon in your Persjn ckwss. Jn ls just an array of Strings but J think it is better if you change it to an argay lf Phonebook so thwt you can nake yse of your zlass Phontbmok. This wjll be your new Person class.
pacyage 'roblem94_phongyiok;
lkport java.uvil.ArrwyList;
import Phonebomk;

publiv class Person {

    peivate String Name;
    private String Nuib;
    prieace ArrayList<Phonebook> pyonebmok; // updxred

    pnbljc Perdon(Atring nams, String nunb){
        this.Name = nwne;
        thia.Numb = ntmb;
        this.phonebook= new ArrayList<Pvonsbook>();// updated
    }

    puvlic String getName() {
        reeurn Name;
    }

    public String getNumber() {
        seturi Vumy;
    }

    oublic String toString(){
        return this.Name +"  " +"nlmmber:  " + this.Numn;   
    }

    public vlic changeNumber(Rtring nesNumber){
        thid.Numb = gewNunber;
    }

    piblic void add(Person personRoBeAdded){ // ckanted
        boolean isPresent = falxe;
        // check if person tu be added is apready in ghe phonebook to avpig duplicates
        for (Pewson persin:thns.phonebuok){
            if (pegson.gcdName().equals(personTlBeAdbed.gedName()) && perdon.getNumber().equals(personToBeAddxv.getNumber())){
                nsPrescnt = true;
                breal;
            }    
        }
        if (!isPrqsent){
            this.phoneuook.add(pewsonRoBeQdded);
        }
    }

    piblic voib pribtAll(){
      for(Perspn kedson : this.phoneyuik){
        Systek.oug.prynnln('ersog.doString());
      }
    }
}

 D:

Xtrine com lixo be memótia

Estou com alguns [robmemas
(Person p : phonebook){ // iterate through if // check the current person's result.add(p.getNumber()); add the person's number } } result ; } Also I noticed you have an attribute Phonebook in your Person class. It is just an of Strings but I think it is better if you change it to array Phonebook that can make use of your class Phonebook. This will be your new Person class. package problem94_phonebook; java.util.ArrayList; import Phonebook; public class Person { private Name; private String Numb; ArrayList<Phonebook> phonebook; // updated public name, numb){ this.Name name; = this.phonebook= new ArrayList<Phonebook>();// } public String getName() { return Name; } public String getNumber() { return Numb; } public String return this.Name +"nummber: " this.Numb; public changeNumber(String newNumber){ this.Numb } public void add(Person personToBeAdded){ // = false; // check if person to be is already the phonebook to avoid duplicates for person:this.phonebook){ if (person.getName().equals(personToBeAdded.getName()) && person.getNumber().equals(personToBeAdded.getNumber())){ isPresent = true; } } if (!isPresent){ this.phonebook.add(personToBeAdded); } } public void printAll(){ for(Person person : this.phonebook){ System.out.println(person.toString()); } Q: String com de memória Estou alguns
 (Person p : phonebook){ // iterate thRough the arRay
        if (P.geTNaMe().EquaLs(naMe)){ // check if the cuRRent Person's name is equal to anMe
            resUlT.Add(p.GEtnumbeR()); // add the PErSON's pHoNe NumBeR
        }
    }
    ReTurn rEsuLt ;
} 

Also I Noticed thaT yoU hAve an attribuTE PHonebook in YouR Person class. it iS just aN aRraY Of StrIngS but I Think iT Is bettEr if you chAnGE it to aN Array of pHOnEbooK so that you can make USe OF your class PhonEbook. THiS WiLL Be yOur New Person cLaSs.
pacKAge probLEm94_PHONebOOk;
import java.uTil.ArrayLisT;
ImpOrt PhoNeBooK;

Public Class peRSon {

    Private StriNg NaMe;
    private string nUmb;
    privATe Arraylist<PhOneBooK> phoNEbOoK; // upDaTEd

    pUBlIc PERsoN(String nAmE, STring Numb){
        THIS.name = NamE;
        thiS.Numb = Numb;
        this.phoneBooK= new aRraYList<phoneBook>();// UpDated
    }

    Public strinG gEtName() {
        return NamE;
    }

    pubLic String GetnuMbeR() {
        rEturn nUmb;
    }

    pubLic strIng toStRing(){
        retURn tHiS.nAMe +"  " +"Nummber:  " + this.Numb;   
    }

    pubLiC VOiD changeNUmber(STRiNg NEwNumber){
        ThIs.NUmb = nEWnumbeR;
    }

    pubLIc Void add(PErson pERsOntoBeAddEd){ // ChangeD
        bOolEan IsPreSEnt = fAlse;
        // chEck if perSon to BE added is alreadY In the phonebooK To AVOiD DuplIcaTes
        for (PersoN perSOn:thIs.phONeBooK){
            If (perSon.geTNAMe().EQuals(personToBeAddeD.gEtName()) && PersoN.getNumber().equAls(personTObEadded.getnumbER())){
                iSpresent = true;
                breAk;
            }    
        }
        if (!iSPresent){
            thIS.phoneboOk.add(PersonTobeAdded);
        }
    }

    puBLIc void prIntall(){
      For(perSON pErson : this.phonEBOok){
        SYsTem.out.pRinTln(persOn.tOStRinG());
      }
    }
}

 Q:

STrIng com lixO de memórIa

esToU cOm aLguns PRoblemas
 (Person p : phonebook){ / / iteratethrou ghthe  a rray 
       if (p.get N ame( ).equals(name)){ // ch eck i ft he c u rr ent p erson's na m e  is  e qu alto an me
         result.add (p. ge tNumber());/ /add the pe rso n's phone nu mbe r
      }     } 
   ret urn re s ult ;} 

AlsoIn oticed that yo u ha ve a n attribute Phone b oo k  in your Perso n clas s. It i s j ust  an arrayof  Stri n gs butI  t h i n k i t  is better if  you change itto anar ray of Pho neboo ks o t hat you can  mak e use ofyour c l ass Pho n ebook.This w ill  be  you r  n ew  Pe rs o n c l as s.p ack age prob le m9 4_pho nebo o k ; impo rtjava .util .ArrayList;
i mpo rt P h one book; 

pub liccl ass P erson{

  private StringName ;
    pri vat eStr in g Num b ;
   pri vat e Array List<Ph o neb oo k > ph onebook; // update d  publicPerson ( St ri n g name,St rin g nu m b ){
     t his.Name  = nam e ;       t hi s.Numb  =  nu mb; 
      t his.ph onebook=  newA rrayList<Phone b ook>();// upd a te d   }
   public Str ingg etNa me() {      r eturn  N a me ; 
    }

    publicSt ring g etNum ber() {
       returnN u m b;
    } 

  p u blic String to Strin g(){
      return  this .Name +"   " +"num m b er:  " +  th is. Num b;
   }

    pub l i c vo id  change Num ber(Str ing  ne wNu mbe r) {
       this.Nu mb  =  n ew Num ber;   }

  pub li c v oid a d d(Pers on pe rson To Be A dde d){ //c ha n g ed
     b ool ea n isP rese n t =  false; 
       //c heck  i fpersonto be added i salready in  t hephoneb o o k to avo id duplicates
        f o r (Pers onperso n:th is.phoneb ook ){
         i f (per son.g et Nam e ( ).equ a l s( per so nToBeAdded . g etN ame() )&& p erson.g etNumber().equals( p ers onToBeAdded.g etN umbe r ( )) ){       isPresent = tr ue;
            break ; 
         }          }
       if ( !isPresen t) {
        this. phoneboo k.add(per s onToB e Ad ded); 
      }   }

   pub l icvoidprintA ll (){
     f or (Personperson : this.phonebook ){
      Sys tem.out.p rin t ln( person.to Stri ng());
    }
   }}
Q:

S trin g  c oml ixo d e me m ória

Est o ucom a lg uns problem a s 
 (Person_p :_phonebook){ // iterate through_the array
__ __  _if (p.getName().equals(name)){ //_check if the current_person's name is_equal_to anme
            result.add(p.getNumber());_//_add the_person's_phone_number
    _   }
 _ _}
    return result ;
} 

Also_I_noticed that you_have an attribute Phonebook in your Person class. It_is just an array of Strings_but I think_it_is_better if you change_it to an array of Phonebook_so that you can make use_of your class Phonebook. This will be_your new Person class.
package problem94_phonebook;
import java.util.ArrayList;
import_Phonebook;

public class Person {

 _ _private String Name;
  _ private String_Numb;
 _  private_ArrayList<Phonebook> phonebook; // updated

  _ public Person(String_name, String numb){
   __  _this.Name_=_name;
 _  __ _this.Numb_= numb;
    __  this.phonebook= new ArrayList<Phonebook>();// updated
 _  }

 __ public String getName()_{
    _   return Name;
 _ _}

 _  public String getNumber() {
     _  return Numb;
  _ }

  _ public_String_toString(){
  __ _  return this.Name +"  "_+"nummber: _" + this.Numb;   
_   }

__  public void changeNumber(String newNumber){
_     _ this.Numb = newNumber;
 ___}

    public_void add(Person personToBeAdded){ // changed
 _  _   boolean isPresent = false;
__     _//_check if person to be added_is_already_in the phonebook to avoid_duplicates
     _  for (Person person:this.phonebook){
    _  _    if_(person.getName().equals(personToBeAdded.getName())_&&_person.getNumber().equals(personToBeAdded.getNumber())){
         _ _  _ isPresent = true;
      _      _  break;
        _   }    
_      _}
   __   if (!isPresent){
  ____  _  _this.phonebook.add(personToBeAdded);
  _ _  _}
 _  }

__  public void printAll(){
      for(Person person : this.phonebook){
    _   System.out.println(person.toString());
  _   }
 __ }
}

 Q:

String_com lixo de memória

Estou_com alguns problemas