I have an exercise which is asking us about basics concept apparently. But I can't find any information or at least I'm not sure about what I'm suppose to search. So I have a small class and I need to comment 3 different constructors. It look like this :
class Person{
private String name;
private ArrayList<String> pseudos;
private String email;
//For me this one isn't a problem, it initialize a name & a mail with the two parameters and I believe the tricky part is this Array. I'm not sure but as far as I know it's okay to initialize the Array whithout getting him through parameter... Maybe I'm wrong.
public Person(String aName, String aEmail){
name = aName;
pseudos = new ArrayList<String>();
email = aMail;
}
//It seems to be the same explanation than the first one.
public Person(){
pseudos = newArrayList<String>();
}
//Apart from the uppercase I thinks this one is good, nothing is wrong.
public Person(String aName, String aMail, ArrayList<String> manyPseudos){
name = aName;
pseudos = new ArrayList<String>();
if(pseudos != null)
{
Pseudos.addAll(manyPseudos); //The uppercase here should be the problem
}
mail = aMail;
}
}
Of course I tried to figured it out through my lesson, but I didn't find anything so i supposed it's an exercise based on logic ... But I lacked of this kind of logic and I really want to at least trully understand this part since it's pretty basics and I will have to manipulate it a lot.
Again, thanks for your guidance and your time.