method/class help
I am having trouble understanding what is asked of me for part of a method. I hate to post it but I can't explain it well myself.
"a method called personInfo that returns a String which contains the information of a Person instance. This method should take a boolean parameter which indicates whether the full data of the person will be included or not. If the parameter evaluates to true, then the method should concatenate, with appropriate labels, the first and last names, age, gender and marital status of the person. If the parameter is false, then only the first and last names should be returned in the string."
This is what I have at the moment and I don't know, in my test person class, how to display Person instances by using the personInfo method passing a true or false value in order to only show the names of the persons.
public String personInfo(){
boolean result =true;
String test ="";
if (result ==true)
test +="First Name: " + firstName +"\nLast Name: " + lastName +"\nAge: " + age
+"\nGender: " + gender +"\nMarital Status: " + maritalStatus;
else
test +="First Name: " + firstName +"\nLast Name " + lastName;
return test;
}
This is what I have in my test person class and it returns the True value every single time.
Person p2 =new Person();
System.out.println(p2.personInfo());
Any comments and all help is appreciated as always.

