Hi
I have an arrayList and i must use a method.
Class AlunoCode:/**
* Method to add a student to the lis, but can't be added if the number (id) already exist.
* Methos return true if the student is added or false
*
* @param aluno student to be added
* @return True if added
*/
public boolean addAluno(Aluno aluno)
{
boolean estado = false;
for(int i=0; i<alunos.size(); i++)
{
if(aluno(Aluno.getID))
{
return false;
}
}
alunos.add(aluno);
return true;
}
The getID method is situated in another class, i have an error saying, canno't find symbol getID..Code:public class Aluno
{
private int id; // Nº do aluno (identificador único)
private String nome; // Nome do aluno
/**
* Construtor dos objectos da classe Aluno
*/
public Aluno(String nome, int ID)
{
this.nome=nome;
this.id=ID;
}
/**
* Definir métodos de acesso e de mutação para os campos,
* considerando que o nº de aluo não pode ser alterado
* getID, getNome, setNome
*/
//Dá o nome do aluno em causa
public String getNome()
{
return nome;
}
//Vai dar quantos ID estão registados
public int getID()
{
return id;
}
//Mudança de nome por mutação
public void SetNome( String name)
{
nome = name;
}
}
any help please?
Thanks

