missing return statement? News to me!
Before I ask anything let be begin by saying thanks to all you people that help others on these boards, I've never posted a question before but I have often found the answers to my problems somewhere here. I'm currently working on one of my last java assignments ever and I am completely stumped as to whats going on. All I want out of this code is for it to read a txt file for a bunch of phone book entries, load them into some arrays, then sort them by first name, last name, then phone# then return the array so I can use it later on. I've got the entries loaded, I've got em sorted, but I can;t return it. When I try I get a missing return statement error. I dont know why its not returning the array, so I thought I'd ask the pros. I can get it to work fine if I dont return anything but what good is that eh?
Please forgive my terrible coding, I am in no way a real programmer, I just want to pass my classs and never think about it again 8) any help would be appreciated. Tis is built to work with an "Entry" file, if you guys need it to proceed lemme know and I will post it. Thanks.
the code....
publicclass CSCD210PhoneBook{
publicstaticvoid main(String[] args)throws IOException
{//Opening main
Scanner kb =new Scanner(System.in);
int entryCount=0;
Scanner fileScanner=null;
Entry[] array=null;
array=populateEntry(entryCount, fileScanner, kb);
}//end main array=
publicstatic Entry[] populateEntry(int entryCount, Scanner fileScanner,Scanner kb)throws IOException
{
int lineCount=0;
String fileName;
File fileHandle;
System.out.println("Which file would you like your entries pulled from?");
fileName= kb.nextLine();
fileHandle =new File(fileName);
fileScanner =new Scanner(fileHandle);
while(fileScanner.hasNext())
{
fileScanner.nextLine();
lineCount++;
}
entryCount= lineCount/8;
Entry[] array=new Entry[entryCount];
fileScanner.close();
fileHandle =new File(fileName);
fileScanner =new Scanner(fileHandle);
for(int i =0; i<array.length;i++)
{
array[i]=new Entry(fileScanner);
}
fileScanner.close();
int curPos, indexSmallest, start;
Entry temp;
for (start = 0; start >< array.length - 1; start++)
{
indexSmallest = start;
for (curPos = start + 1; curPos < array.length; curPos++)
{
if (array[indexSmallest].compareTo(array[curPos]) > 0)
{
indexSmallest = curPos;
}
}// end for
temp = array[start];
array[start] = array[indexSmallest];
array[indexSmallest] = temp;
return array;
}
}
Any help would be most appreciated.

