I would like to add contacts to a ArrayList
, but adding initial values to the attribute.
First I created a Contact Call class, and I want to create a contact type ArrayList and would like to know how to add data to this ArrayList
This is the contact class:
public class Contato implements ModeloContato {
// ATRIBUTOS
private String nome;
private int telefone;
private String endereco;
//METODODOS ESPECIAIS
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public int getTelefone() {
return telefone;
}
public void setTelefone(int telefone) {
this.telefone = telefone;
}
public String getEndereco() {
return endereco;
}
public void setEndereco(String endereco) {
this.endereco = endereco;
}
//METODOS DA INTERFACE
@Override
public void getnome() {
}
@Override
public void gettelefone() {
}
@Override
public void getendereco() {
}
}
this is the main:
public class Main {
public static void main(String[] args) {
ArrayList<Contato> agenda = new ArrayList<Contato>();
Contato a = new Contato ();
Contato b = new Contato ();
Contato c = new Contato ();