In: Computer Science
import java.lang.*;
import java.util.*;
public class Main {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
Contacts[] contactObj = new Contacts[5];
for(int i = 0; i<5; i++){
String name= sc.nextLine();
String phoneNumber= sc.nextLine();
String emailAddress= sc.nextLine();
contactObj[i] = new Contacts(name, phoneNumber, emailAddress);
}
display(contactObj);
}
public static void display(Contacts[] contactObj)
{
for(int j=0;j<5;j++)
{
System.out.println(contactObj[j].getname());
System.out.println(contactObj[j].getphoneNumber());
System.out.println(contactObj[j].getemailAddress());
}
}
}
class Contacts
{
String name;
String phoneNumber;
String emailAddress;
Contacts(String name,String phoneNumber,String emailAddress){
this.name= name;
this.phoneNumber= phoneNumber;
this.emailAddress= emailAddress;
}
public void setname(String name) {
this.name= name;
}
public void setphoneNumber(String phoneNumber) {
this.phoneNumber= phoneNumber;
}
public void setemailAddress(String emailAddress) {
this.emailAddress= emailAddress;
}
public String getname() {
return this.name;
}
public String getphoneNumber() {
return this.phoneNumber;
}
public String getemailAddress() {
return this.emailAddress;
}
}