I'm doing an homework question, and not sure what is wrong with my code. The question is: http://prntscr.com/1xe4gd.
My code so far:
public class Person //This is the class
{
String firstName;
String familyName;
boolean isFemale;
String partner;
}
My method so far is:
Person getAngelinaJolie()
{
Person person1 = new Person();
person1.firstName = "Angelina";
person1.familyName = "Jolie";
person1.isFemale = false;
person1.partner.firstName = "Brad";
person1.partner.familyName = "Pitt";
return person1;
}
When I compile, error says "cannot find symbol - variable firstName". Could anyone please help me with this. Not sure why it cant find the symbol.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…