i create Contact class it has these variables :-
public class Contact {
String name;
String email;
String phoneNumber;
}then i create another class to add and search Contact :-
public class ContactManager {
Contact [] myFriends;
Contact [] phonesNumbers;
int friendsCount;
ContactManager(){
this.friendsCount = 0;
this.myFriends = new Contact[500];
this.phonesNumbers = new Contact[500];
}
void addContact(Contact contact){
myFriends [friendsCount] = contact;
friendsCount++;
}
Contact searchName(String searchName){
for (int i = 0; i < friendsCount; i++){
if (myFriends[i].name.equals(searchName)){
return myFriends[i];
}
}
return null;
}in the main method i created new Contact object three times and i called add and search methods from ContactManager class.
the question is :-
how to print the Contact or phone numbers
I can't know