returning index in array
Posted on 2013-12-07
This is the method I wrote for the object I created "Person." In the directory class I also wrote. Directory d = new Directory(directoryDataFile) I also have an array of person called "people"
public Person inDirectory(String Lastname)
for(int k = 0; k < directorySize ; k++)
flag = true;
This is a portion of the main method I'm trying to use it in:
String command = stdin.next();
String Lastname = stdin.next();
if (d.flag = true)
System.out.println(Lastname + " is NOT in the directory");
My problem is, this keeps returning null instead of saying the the person is in the list. I can't figure out why. Does the excerpts I placed above make sense or do you need more info ?