Probleme accès aux méthodes
Bonjour, voici mon problème :
J'ai une classe Register :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| public class Register
{
// instance variables - replace the example below with your own
private Student s;
private Course c;
private int mark;
public Register(Student st,Course co)
{
s=st;
c=co;
}
public Register (Student st,Course co, int m) {
s=st;
c=co;
mark=m;
}
public String getRegister()
{
return s.getName()+c.getName();
}
public Student getStudent()
{
return s;
}
public Course getCourse()
{
return c;
}
} |
Lorsque j’essaie d'accéder aux méthodes comme suit :
Code:
1 2 3 4 5 6
| public void unregister(Student s, Course c) throws UniversityException {
Iterator it = myRegister.iterator();
while (it.hasNext())
if(it.next().getStudent()==s && it.next().getCourse()==c)
myRegister.remove(it.next());
} |
J'ai cette erreur : cannot find symbol : method getStudent()
Je vois pas pourquoi.
PS :
*j'implémente myRegister comme ceci : myRegister.add(new Register(s,c));
*
Code:
1 2 3
| Iterator it = myStudent.iterator();
while (it.hasNext())
System.out.println(it.next().toString()); |
Ici toString() fonctionne.
Merci de votre aide.